如何从URL中删除index.php?我在.htaccess中编写了代码(如下所示),但是当我进入rocketfirm.com/index.php/business.html输出robotfirm.com/b和404找不到页面时,什么都没发生
RewriteRule ^index.php/([0-9A-Za-z_]) /$1 [L,R=301]
RewriteRule ^page/([0-9]+)(/?)$ index.php?cstart=$1 [L,QSA]
RewriteRule insurance-for-you/insurance-for-family /comfort.html [L,R=301]
RewriteRule insurance-for-yourself/accident-insurance /ns.html [L,R=301]
答案 0 :(得分:1)
将此代码放在.htaccess中
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
从网址中删除index.php并保存POST参数