简体   繁体   English

.htaccess直接链接路由

[英].htaccess direct links routing

I am using front page controller and route all request to index.php with .htaccess: 我正在使用首页控制器,并使用.htaccess将所有请求路由到index.php:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -!f
RewriteCond %{REQUEST_FILENAME} -!d
RewriteRule . index.php [L,QSA]
</IfModule>

But this is cfg doesn't work with direct links (like http://example.ru/index.html ) and open this .html file, but i need to even in this case, routing to the index.php . 但这是cfg不能用于直接链接(如http://example.ru/index.html )并打开此.html文件, 但是即使在这种情况下,我也需要路由到index.php How i can do this? 我该怎么做?

Below should work by redirecting all to index.php using ^.* 下面应该通过使用^。*将全部重定向到index.php来工作

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L,QSA]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM