当用户访问domain.com/test/时,默认情况下应显示domain.com/test/folder/index.php。
index.html <-- current homepage
/test/ <-- .htaccess file
/folder/
index.php
目前我使用:
DirectoryIndex folder/index.php
但是还有别的办法吗?我尝试过RewriteRule,但它不起作用:
RewriteRule ^(.*) /folder/index.php [NC,L,QSA]
您可以在/test/.htaccess
:中使用此规则
DirectorySlash Off
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[^/]*$ folder/index.php [L]