We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40122
    • 330 Posts
    I have the following 301 redirect in my .htaccess file:

    RewriteRule ^engines_diesel http://www.mysite.com/kubota-engines-for-sale.html [R=301,L]


    which works fine.

    However, I also need to redirect crawled URLs that have php vars in their names, such as:

    RewriteRule ^?q=product_info.php&products_id=144 http://www.mysite.com/products-for-sale.html [R=301,L]


    This in its current form doesnt work.

    Does anyone know the right way of doing this?

    Thanks!
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      Should work like this:
      RewriteRule ^?q=product_info.php&products_id=([0-9]+) http://www.mysite.com/products-for-sale.html?products_id=$1[R=301,L]