RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^aboutus/our-mission/?$ our-mission.php [L,QSA]
RewriteRule ^([^\.]+)$ $1.php [NC,L]
我在htaccess中尝试上面的代码,像Js这样的资源,Css正在从aboutus /而不是root加载,而our-mission.php在根目录下。
答案 0 :(得分:0)
.htaccess行有例外和优先级。这是一个修复。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.(?:css|js|jpe?g|gif|png)$ [NC]
RewriteRule ^aboutus/our-mission/ our-mission.php [L]
RewriteRule ^([^\.]+)$ $1.php [NC,L]