1

我想通过使用 htaccess 摆脱主页的斜杠。

我的实际网址是这样的

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/

我想摆脱这个斜杠。IE,

我想要的 URL http://www.mydomain.com

这个怎么做?

任何帮助,将不胜感激。

4

1 回答 1

1

您不需要 RewriteCond ,因此将您的规则更改为此并清除浏览器缓存:

RewriteRule ^(.*)/iphone_index.php$ $1 [R=302,L]

一旦您确定它正在工作,请更改R=302R=301

于 2012-03-05T11:00:03.887 回答