Bluehost : 301 Redirect in .htaccess

Host unlimited blogs, websites for $4.95 only with this web host
Register domain names for less than a dollar here
Get a VPS or dedicated server for less than $50 Signup Now

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

Related Posts :

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

Sorry, comments for this entry are closed at this time.