[英].htaccess to redirect everything to index.php, but keep a copy of the website in a subdirectory
[英]How to Redirect Subdirectory Files to index.php?
我添加以下代码将所有请求重定向到.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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.