我需要像一样重定向损坏的url
domain.com/.php到domain.com/index.php
有人知道怎么做吗??我试着使用一些像这样的htaccess生成器
http://htaccessredirect.net/index.php
并获取此代码,但重定向循环/错误
我已经尝试了以下代码,但无法使用
Redirect 301 /.php index.php
我也试过了,但出错了
RewriteCond %{HTTP_HOST} ^/.php$
RewriteRule ^$ index.php [L,R=301]
您需要转义句点,否则它将成为正则表达式的一部分。
像这样:
RewriteRule ^/.php$ /index.php [L,R=301]
或:
RedirectMatch 301 ^/.php index.php