我添加了以下代码将所有请求重定向到.htaccess中的index.php文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !('.php|)$
RewriteRule . /index.php [L]
</IfModule>
但是子目录中有。htm文件没有重定向到index.php。如何重定向子目录中的所有文件到index.php?对不起,我的英语不好。谢谢。
根据Apache的DirectoryIndex文档,只需将以下内容放在与index.php相同目录下的.htaccess文件中:
DirectoryIndex index.php index.html