Redirect site.com to www.site.com

Discussion in 'Apache' started by peter_anderson, Jul 27, 2008.

  1. #1
    peter_anderson, Jul 27, 2008 IP
  2. Dhvanesh

    Dhvanesh Peon

    Messages:
    356
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Place the following code in .htaccess file

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

    In the above code place your site name instead of "domain" and upload .htaccess file.

    I hope this will help you.
     
    Dhvanesh, Jul 27, 2008 IP
    peter_anderson likes this.
  3. peter_anderson

    peter_anderson Notable Member

    Messages:
    3,382
    Likes Received:
    152
    Best Answers:
    0
    Trophy Points:
    240
    #3
    Thanks!

    +rep :)
     
    peter_anderson, Jul 27, 2008 IP
  4. popowich

    popowich Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    110
    #4
    You can also do it out of your httpd.conf file.

    -Raymond

     
    popowich, Jul 27, 2008 IP