我想用htaccess去掉主页上的斜杠。
我的实际URL类似于此
http://www.mydomain.com/iphone_index.php
我通过htaccess从URL中删除了iphone_index.php。我用来做这件事的代码是——
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^.*/iphone_index.php
RewriteRule ^(.*)iphone_index.php$ $1 [R=301,L]
但我得到的结果是
http://www.mydomain.com/
我想去掉这个斜线。即
我想要的URLhttp://www.mydomain.com
如何做到这一点?
如有任何帮助,我们将不胜感激。
您不需要;不需要在此处重写代码,因此将您的规则更改为此并清除浏览器缓存:
RewriteRule ^(.*)/iphone_index.php$ $1 [R=302,L]
一旦您确定它正在工作,请将R=302
更改为R=301