从url中删除'index.php'而不删除.htaccess中的参数 [英] Remove 'index.php' from url without removing parameters in .htaccess
问题描述
我有网址重定向条件,
www.domain.com/something/anotherthing/index.php
www.domain.com/something/anotherthing/index.php
我需要上面的网址重定向到
i need the above url to redirect to
www.domain.com/something/anotherthing /
www.domain.com/something/anotherthing/
如果我去
www.domain.com/index.php/something/anotherthing
www.domain.com/index.php/something/anotherthing
我想重定向到
www.domain.com/something/anotherthing
www.domain.com/something/anotherthing
我有一个重定向htaccess规则这个
i have a redirect htaccess rule for this
RewriteCond%{THE_REQUEST} ^ [AZ] {3,} \ s (。*)/ index.php $ 1 [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index.php$1 [NC]
RewriteRule ^ /%1 $ 1 [R = 301,L]
RewriteRule ^ /%1$1 [R=301,L]
但这适用于第一个条件,但在后来它将我重定向到根页面。任何人都可以帮助这个重定向。
But this works for the first condition but in the later it redirect me to the root page. Can anyone please help in this redirection.
先谢谢。
推荐答案
尝试这样的事情:
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index.php/?([^\ \?]*) [NC]
RewriteRule ^ %1/%2 [R=301,L]
这应该处理 /index.php
的任何位置。
That should handle any location of /index.php
.
这篇关于从url中删除'index.php'而不删除.htaccess中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!