Regexp / htaccess rewrite fun

Question!

I have a long list of URLs from an old site structure that I need to redirect using RedirectMatch to new URLs on the same domain. The trick is that the old (source) URLs contain a bunch of messy variables. That's not a problem, right? I just put in place some sweet little Regexp statements to handle those variables. That's what I did, and it matches the variables correctly. Sweet!

The problem comes with the second part of the RedirectMatch statement - the destination. RedirectMatch is correctly resolving the old URLs to the new URLs, except that the old variables are appended to the new URL. I want to keep the redirects, but have the destination URL not contain the variables. Here is my code:

RedirectMatch 301 ^/Shop/Category1/Category2/(.*)$ http://www.website.com/garage.html

Actual Redirect URL:

http://www.website.com/garage.html?launch_pg=itemZoomView&launch_sel=1009152&launch_pg_sp=true&title=Pig+Waste+Can

Can anybody point me to what I am doing wrong here? I just want to get rid of those crummy old variables and start fresh.



Answers

If by "variables" you mean query string (the launch_pg=itemZoomView

By : LazyOne


This video can help you solving your question :)
By: admin