Tuesday, June 5, 2012

Quick mod_rewrite help on GoDaddy

This htaccess works fine locally, but on GoDaddy the URL isn't caught by the rewrite engine.

RewriteEngine on

RewriteRule ^products/amsoil/(.*)/$ /products.php?amsoil=$1 [L]
RewriteCond %{HTTP_HOST} ^somedomain.com
RewriteRule (.*) http://www.somedomain.com/$1 [R=301,L]

This worked until a few days ago. Basically www.somedomain.com/products/amsoil/this-product/ should forward to www.somedomain.com/products.php?amsoil=this-product ....did work, and still works locally however now I just get a 404 error on www.somedomain.com/products/amsoil/this-product/

Any ideas?

Source: Tips4all

1 comment:

  1. I verified that the following script works on our current hosting plans:

    RewriteEngine on
    rewritecond %{http_host} ^coolexample.com [nc]
    rewriterule ^(.*)$ http://www.coolexample.com/$1 [r=301,nc]

    There is a possibility that you are on an older version of our hosting plans. If that is the case, you may want to consider upgrading. Check out http://x.co/Zecq for a how-to on upgrading. There is also a link to the 4GH FAQ. Please review that before upgrading to avoid unwanted surprises.