Mod rewrite domain.com to www.domain.com, how ?

Discussion in 'Apache' started by fatabbot, Dec 15, 2006.

  1. #1
    Hi,


    What would be the rule in htaccess to make everyone who types domain.com automatically bring to www.domain.com ?
    Is this a problem for the search engines ?
     
    fatabbot, Dec 15, 2006 IP
  2. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.domain\.com
    RewriteCond %{SERVER_PORT} ^80
    RewriteRule (.*) http://www.domain.com/$1 [R=301,QSA,L]
     
    maiahost, Dec 15, 2006 IP
    fatabbot likes this.
  3. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Thanks maiahost, that works
     
    fatabbot, Dec 16, 2006 IP