Host unlimited blogs, sites, forums for $4.95 only with this host

Bluehost : 301 Redirect in .htaccess

Bluehost is among our best web hosts. Sign up with bluehost here

This is a bluehost question posted by Rodrigo on 26 June 2007

I want to set www version as my prefered domain (redirecting non-www version to www version). I’ve found 2 ways to do this with .htaccess.

First way:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]

Second way:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^(.*)\.yoursite\.com$ [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]

Which one is correct?

You can read more about bluehost in detail or sign up now with bluehost web hosting

This entry was posted in Bluehost Host Bookmark this post and come back later for the best web hosting coupons.

This web hosting blog is proudly hosted with reliable Hostgator webhosting for only one cents through this hostgator coupon. If you're new here, you may want to subscribe to this web hosting RSS feed

-->