繁体   English   中英

.htaccess直接链接路由

[英].htaccess direct links routing

我正在使用首页控制器,并使用.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 我该怎么做?

下面应该通过使用^。*将全部重定向到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