如何从example.com/projects/login
重定向到example.com/projects/login/index.php
?
我的.htaccess:
#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
#Removing .PHP Extension
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# Set XSS Protection header
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>
答案 0 :(得分:2)
这不需要任何重写规则。只需在.htaccess顶部使用trainable=False
指令:
DirectoryIndex