重写标志和静态字重定向问题

时间:2017-07-01 09:01:37

标签: php .htaccess

    RewriteEngine on
    RewriteRule account$ account.php [Nc]
    RewriteRule (.+)$ store.php [Nc]

当我访问http://localhost/project/account时,应将其重定向到account.php

如果我访问http://localhost/project/sun-glass,则应将其重定向到store.php

1 个答案:

答案 0 :(得分:1)

限制现有文件和目录的最后一条规则:

Options -MultiViews
RewriteEngine on

RewriteRule account/?$ account.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . store.php [L]