Reputation: 211
Hi I am trying to redirect from http://www.domain.com/prod.php?id=23 To http://www.domain.com/index.php?q=35
I tried something like the following
RewriteRule ^(.*)/prod.php\?products_id=23$ $1/index.php?q=35 [NC,L]
But not working
The following works but I want the redirection for specific query string.
redirect /prod.php http://www.domain.com/index.php?q=35 [NC,L]
I got it, it was
RewriteCond %{query_string} ^products_id=23 [NC]
RewriteRule prod\.php$ /index.php?q=35 [R=301,L]
Upvotes: 0
Views: 99
Reputation: 13308
I'm dealing with mod_rewrite to redirect my urls and to train myself I was looking Stack overflow posts with the tag
redirect
... not importantI stumbled upon this resolved post but turns out like it has no accepted answer (just an edit in the question) but the post then remains in the unanswered posts stack, consider the following answer as the accepted one, or write it yourself and check it as well for the benefit of the community...
acceptable answer
RewriteCond %{QUERY_STRING} products_id=23 [NC]
RewriteRule ^prod\.php$ /index.php?q=35 [R,QSA,L]
Upvotes: 1