我想从
更改我的网址http://intervideo.2watt.net/component/content/article.html?id=65&Itemid=479
到
http://intervideo.2watt.net/component/content/article.html?id=65&Itemid=332
我已经尝试了以下代码,但它无法正常工作
RewriteRule ^/?Itemid=479/(.*)$ Itemid=332/$1 [R=301,L]
答案 0 :(得分:2)
您无法从RewriteRule
捕获查询字符串。改为使用RewriteCond
:
RewriteCond %{QUERY_STRING} ^(id=\d+)&Itemid=479$ [NC]
RewriteRule ^component/content/article\.html$ %{REQUEST_URI}?%1&Itemid=332 [L,NC,R=302]