我正在使用首页控制器,并使用.htaccess将所有请求路由到index.php:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -!f
RewriteCond %{REQUEST_FILENAME} -!d
RewriteRule . index.php [L,QSA]
</IfModule>
但这是cfg,不适用于直接链接(如http://example.ru/index.html)并打开此.html文件,但即使在这种情况下,我也需要路由到index.php 。我该怎么办?
答案 0 :(得分:0)
以下应通过使用^。*将所有内容重定向到index.php来工作。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L,QSA]