htaccess rewrite at GoDaddy fix

If you are having an issue with a mod rewrite not working at GoDaddy, be careful with the case used in your .htaccess file.

Here is an example of a non-www mod rewrite rule that should work. Check the case of ‘RewriteEngine….’. Be sure that it is a lower case ‘r’ (for example: rewriteEngine).

This is the kind of simple issue that will have you pulling your hair out. It took me a bit to figure it out. This issue is not a global one. GoDaddy does just fine with upper case naming on some servers, not the case on others.

# Used for the non-www redirect
rewriteEngine on
rewriteCond %{HTTP_HOST} !^www..*
rewriteCond %{HTTP_HOST} !^$
rewriteCond %{HTTP_HOST} ^([^.]*).(com)
rewriteRule ^.*$ http://www.%1.%2%{REQUEST_URI} [R=permanent,L]

Leave a Reply

Your email address will not be published. Required fields are marked *