一段时间以来,我一直在 .htaccess 文件中使用以下代码,以使 EE URL 正常工作,而无需在 URL 中使用 index.php。我发现,虽然我从爬行工具中收到一些报告,但我得到了重复的内容,如 /lorem/ipsum/ 也以 /index.php/lorem/ipsum/ 的形式出现在某处。
我知道这可能是由于 URL 中引用了 index.php 的杂散链接造成的,但我想通过强制将 index.php 排除在链接之外来弥补差距。我环顾四周,但似乎找不到如何强制它出来。
RewriteEngine On
RewriteBase /
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
当然可以。
# Enable Rewrite Engine
# ------------------------------
RewriteEngine On
RewriteBase /
# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteCond %{THE_REQUEST} ^GET
RewriteRule ^index\.php(.+) $1 [R=301,L]
# Standard ExpressionEngine Rewrite
# ------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)