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