Change a particular string in url using htaccess

I want to change my url from

http://intervideo.2watt.net/component/content/article.html?id=65&Itemid=479

to

http://intervideo.2watt.net/component/content/article.html?id=65&Itemid=332

I have tried the following code but it is not working

RewriteRule ^/?Itemid=479/(.*)$ Itemid=332/$1 [R=301,L]

Upvotes: 2

Views: 132

Answers (1)

anubhava
anubhava

Reputation: 786091

You cannot capture query string from RewriteRule. Use a RewriteCond instead:

RewriteCond %{QUERY_STRING} ^(id=\d+)&Itemid=479$ [NC]
RewriteRule ^component/content/article\.html$ %{REQUEST_URI}?%1&Itemid=332 [L,NC,R=302]

Upvotes: 1

Related Questions