2
我正在使用的.htaccess这些规则和条件,把这些的.htaccess边缘情况
http://www.example.com/index.php/about/history
http://www.example.com/about/history/index.php
到
http://www.example.com/about/history
的.htaccess
# ensure there is no /index.php in the address bar
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ $1 [R=301,L,NS]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.php(.*)\ HTTP/ [NC]
RewriteRule ^index\.php/(.*) $1 [NS,NC,L,R=301]
除了有这样的情况,如果URL是
http://www.example.com/about/index.php/history/
这将导致无限循环的重定向。现在我知道这可能是罕见的,但我希望它不会发生,如果可能的话。我如何改变我的规则以适应此?
More info here about my .htaccess
这条规则其中URL的index.php开始在第一个例子/像不起作用。但是,它与其他示例一起工作。 – alex 2009-05-25 04:24:29