【发布时间】:2014-06-03 12:12:44
【问题描述】:
重定向 joomla 原生链接:
http://somesite.com/index.php?option=com_content&view=article&id=151&Itemid=40
=>
RewriteCond %{QUERY_STRING} option=com_content&view=article&id=151&Itemid=40
RewriteRule ^index\.php$ /epr/active-requests? [NC,R=301]
我需要使用附加 URL 参数重定向 joomla 文章 - RQNB:
链接 1:
=>
链接 2:
=>
请注意 Link1 和 Link2 指向不同的应用程序:
1)http://somesite.com/epr/active-requests?RQNB=1111
2)http://somesite.com/dr/active-requests?RQNB=2222
如何向 htaccess 添加参数条件?我需要另一行 RewriteCond 吗?谢谢。
编辑:
脏链接可能有一些其他不需要的参数(如 &PG=REQ),我只需要捕获 RQNB:
http://somesite.com/index.php?option=com_content&view=article&id=151&Itemid=40&RQNB=1111&PG=REQ
编辑2:
试过了,还是不行。。。 第一行:捕获 "&Itemid=40" 之后的所有内容 第二行:仅从第一行结果中捕获 &RQNB
RewriteCond %{QUERY_STRING} ^option=com_content&view=article&id=151&Itemid=40(.*)$ [NC]
RewriteCond %{QUERY_STRING} ^RQNB=(.*)$ [NC]
RewriteRule ^index\.php$ /epr/active-requests?RQNB=%2 [NC,R=301]
【问题讨论】:
标签: apache .htaccess mod-rewrite query-string