301 Redirect in .htaccess not working on some URLs


I’m trying to redirect a load of URL’s using the following code (on each URL):

redirect 301 /index.php?p=example&sub_id=example&prod_id=example http://www.example.co.uk/new-page

If the URL has multiple parameters the redirect won’t work, but if it’s a static URL the redirection worked fine.

Any ideas?



There is no URL “/index.php?p=example&sub_id=example&prod_id=example”, so the 301 will never apply. The URL you’ve given there is “/index.php”, with additional parameters.

You would be better off to use mod_rewrite to remap the query string into a static-looking URL, which you can then 301 if you need to.