.htaccess rewrite on Godaddy

For some reason GoDaddy has been a royal pain to get my htaccess files working properly but I finally found a decent solution.  First off, make sure you aren’t running Windows for your hosting package or this will not work. Below is a quick snippet that will create SEO friendly htaccess rewrites for your url. Simple copy the code and insert your related domain name where it says “yourdomainnamehere.com” and then add this to the top of your htaccess file and upload it to the server.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^yourdomainnamehere.com [nc]
rewriterule ^(.*)$ http://www.yourdomainnamehere.com/$1 [r=301,nc]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.yourdomainnamehere.com/$1 [R=301,L]

The following snippet will rewrite your domain from “yourdomainnamehere.com” to force the “www” in front of it so it would appear as “http://www.yourdomainhere.com”.

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

The second part of the snippet will force your index.html to rewrite to your home domain of “http:www.yourdomainnamehere.com” instead of looking like “http://www.yourdomainnamehere.com/index.html”.

RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.yourdomainnamehere.com/$1 [R=301,L]

For more on basic htaccess checkout this post

By |June 28th, 2011|SEO|0 Comments

Leave A Comment