我在 .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/
这将导致无限循环的重定向。现在我知道这可能是一种罕见的情况,但如果可能的话,我希望它不要发生。我怎样才能改变我的规则以适应这种情况?