skip to Main Content

I am cleaning up some old stuff and I need to do some 301 redirects.

For example:

I have tried with htaccess:

RedirectMatch 301 /product.asp?product=371&sub=0&page=1 /category/test

But above code will not work, It is showing the 404 page and ignoring the redirect I just made. Note please that product.asp does not exists as a file!

However if I use:

RedirectMatch 301 /product.asp /category/test/

It works sort off, but now I can’t do redirects, based on the query string for that specific file.

Any suggestions? Btw I am using Prestashop=)
Best, Simon



  1. You cannot match query string using RedirectMatch directive. Use mod_rewrite rule instead:

    RewriteEngine On
    RewriteCond %{QUERY_STRING} product=371&sub=0&page=1
    RewriteRule ^product.asp$ /category/test/? [L,NC,R=301]

    ? in the target is to strip off existing query string.

    Login or Signup to reply.
  2. mod_alias is designed to handle simple URL manipulation tasks. For more complicated tasks such as manipulating the query string, use the tools provided by mod_rewrite.

    from here

    Just add the rules from @anubhava answer into Prestashop .htaccess and it will works. Better to do it before # ~~start~~ line, you will see notice in the file.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top