Rewrite Rule with Querystring parameter in URL
4 posts
• Page 1 of 1
- anavagomez
- Posts: 3
- Joined: 21 Jan 2015, 15:50
Rewrite Rule with Querystring parameter in URL
Hello,
I would like to do Redirect (301) from this URL:
http://localhost/shop/cart-sale?cid=25MSNVEN
To this URL:
http://localhost/tech/cart.htm?cid=25MSNVEN
The code I am using:
RewriteCond %{QUERY_STRING} ^cid=(.*)$ [NC]
RewriteRule ^/shop/cart-sale$ /tech/cart.htm$1 [R=301,NC,L]
But I keep getting to http://localhost/shop/cart-sale?cid=25MSNVEN
Anybody knows how can I modify my rule so the redirect work correctly?
Thanks in advance.
Best Regards.
I would like to do Redirect (301) from this URL:
http://localhost/shop/cart-sale?cid=25MSNVEN
To this URL:
http://localhost/tech/cart.htm?cid=25MSNVEN
The code I am using:
RewriteCond %{QUERY_STRING} ^cid=(.*)$ [NC]
RewriteRule ^/shop/cart-sale$ /tech/cart.htm$1 [R=301,NC,L]
But I keep getting to http://localhost/shop/cart-sale?cid=25MSNVEN
Anybody knows how can I modify my rule so the redirect work correctly?
Thanks in advance.
Best Regards.
Re: Rewrite Rule with Querystring parameter in URL
Please try to use the following rule instead:
RewriteCond %{QUERY_STRING} ^cid=.*& [NC]
RewriteRule ^/shop/cart-sale$ /tech/cart.htm [R=301,NC,L]
RewriteCond %{QUERY_STRING} ^cid=.*& [NC]
RewriteRule ^/shop/cart-sale$ /tech/cart.htm [R=301,NC,L]
- anavagomez
- Posts: 3
- Joined: 21 Jan 2015, 15:50
Re: Rewrite Rule with Querystring parameter in URL
Hi Anton,
Would you explain to me how the cid parameter will be added to the redirect : /tech/cart.htm
?
Thank you very much.
Would you explain to me how the cid parameter will be added to the redirect : /tech/cart.htm
?
Thank you very much.
Re: Rewrite Rule with Querystring parameter in URL
By default the query string from requested URL is appended to rewritten URL if no other query string is manually added to it.
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests