我以前看过这个问题,但这里没有答案:.htaccess规则,用于在网址末尾删除index.php
我和原始海报有同样的问题。我的Joomla网站上有网址,这些网址最后显示为index.php。我希望所有以index.php结尾的网址都重定向到同一页,而结尾没有index.php。
例如:www.mysite.com/forum/index.php应该重定向到www.mysite.com/forum
我已经尝试过此代码
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]
但这会将所有带有index.php的URL重定向到我的网站主页
示例www.mysite.com/forum/index.php最终被重定向到www.mysite.com
任何帮助,将不胜感激!
您可以将此规则用作第一条规则:
RewriteCond %{THE_REQUEST} !/admin/ [NC]
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句