我正在使用首页控制器并将所有请求路由到索引.php 使用 .htaccess:
<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文件,但即使在这种情况下,我也需要路由到索引.php。我该怎么做?
下面应该通过使用^将所有重定向到索引.php来工作。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L,QSA]