I need to set up a redirect for several thousand always changing URLS.
FROM THIS - example.com/product?product_id=blue_alwayschanging
TO THIS - example.com/widget?product_id=blue_alwayschanging
With my limited knowledge, I'm thinking something like the below is a step in the right direction. What am I missing? It's not working.
RewriteEngine on
RedirectMatch 301 ^/product?product_id=blue_.* /widget?product_id=.*
RewriteEngine activates mod_rewrite. Whereas RedirectMatch is a mod_alias directive. RedirectMatch also does not match against the query string, but then you don't need to, since the query string simply needs to be passed onto the target unchanged.
Try replacing your current code with the following one-liner:
RedirectMatch 301 ^/product /widget
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With