Regexp / htaccess rewrite fun


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/(.*)$

Actual Redirect URL:

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.


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

By : LazyOne

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