Site Redirecting

Discussion in 'Site & Server Administration' started by Kaabi, Jan 3, 2008.

  1. #1
    I know there is a code you can put in the .htaccess of a site, which makes it redirect so if the user types in "http://example.com" or anything, it redirects to "http://www.example.com". Can anybody give me that code? Do you need to know the domain name I want to redirect to write it (although you can always just give me the template code and I could insert the domain name).
     
    Kaabi, Jan 3, 2008 IP
  2. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
     
    maiahost, Jan 4, 2008 IP
    Kaabi likes this.
  3. Kaabi

    Kaabi Well-Known Member

    Messages:
    1,267
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    153
    #3
    Thank you! Green repped.
     
    Kaabi, Jan 4, 2008 IP