#1
  1. No Profile Picture
    Permanently Banned
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Dec 2007
    Location
    Canada
    Posts
    156
    Rep Power
    0

    .htaccess domain redirect domain.com to www.domain.com


    Hi I'm trying to get my domain to redirect from domain.com to www.domain.com.

    I used the following code which generates a server error:

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

    Does anybody know what I could be doing wrong. Might it be something that has to be set in the apache conf file ?
  2. #2
  3. Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    May 2008
    Location
    Ontario, Canada
    Posts
    223
    Rep Power
    15
    I use the following commands:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain.com
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

    Also make sure AllowOverride is enabled in your Apache .conf file.
  4. #3
  5. No Profile Picture
    Permanently Banned
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Dec 2007
    Location
    Canada
    Posts
    156
    Rep Power
    0
    I have AllowOverride set to AutoConfig like below. How would I change it to allow .htaccess ?

    <Directory "/usr/local/apache/mysite">
    AllowOverride AuthConfig
    FileETag None
    </Directory>

Similar Threads

  1. 301 redirect, but SERPS showing old domain
    By searchperfect in forum Google Optimization
    Replies: 3
    Last Post: Apr 12th, 2005, 01:26 AM
  2. Redirect domain.com to www.domain.com
    By Blake in forum Google Optimization
    Replies: 0
    Last Post: Aug 9th, 2003, 01:19 PM
  3. local domain and redirect
    By viggen in forum Google Optimization
    Replies: 1
    Last Post: Apr 29th, 2003, 12:24 PM
  4. Dealing with domain.com vs. www.domain.com
    By dhecker in forum Google Optimization
    Replies: 3
    Last Post: Apr 20th, 2003, 05:21 PM

IMN logo majestic logo threadwatch logo seochat tools logo