【发布时间】:2015-10-25 19:16:24
【问题描述】:
我需要用类似的东西重写一个 URL
/index.php?option=com_scoreboard&view=scoreboard&agent=001C0000016rJeUIAU
到
/quote/?agent=001C0000016rJeUIAU.
这是我到目前为止所得到的。
RewriteCond %{QUERY_STRING} agent=(\w+)&?
RewriteRule ^index.php /quote/?agent=%1 [R=301,L]
这很好用,但它以无限循环结束。我也知道为什么,因为它一直在寻找agent=。我应该在重写规则中添加什么来阻止这种情况?
我也尝试过类似的变体
RewriteCond %{QUERY_STRING} ^option=\w+?&agent=(\w+)&?
RewriteRule ^index.php /quote/?agent=%1 [R=301,L]
但它以相同的无限重定向结束。
这也适用于 Joomla 网站,如果有帮助的话。所以在这条规则之后是标准的 Joomla 重写。
非常感谢!
【问题讨论】:
标签: php apache .htaccess mod-rewrite joomla