Tutorial: use .htaccess to forward domain.com to www.domain.com

Discussion in 'Search Engine Optimization' started by Accelerated Media, Dec 5, 2007.

  1. #1
    Place the following .htaccess in your public_html directory.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    Code (markup):
    Ta - Da! All links pointed at domain.com go to www.domain.com

    If you would like a better explanation of what this does, check out the actual "Force WWW In URL With .htaccess" tutorial on the Promotion & Marketing Techniques blog.
     
    Accelerated Media, Dec 5, 2007 IP
  2. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #2
    I usually report and go after these type of posts, but since you actually posted the method with your link I don't consider this spam, but it is border line. Thanks for the info, will help some amature webmasters for sure.
     
    astup1didiot, Dec 5, 2007 IP
  3. Accelerated Media

    Accelerated Media Banned

    Messages:
    597
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I try to put the essential info in the post, but not copy and paste the post from my blog so there's no duplicate content. (I hate those kinds of posts too, that claim a tutorial, and just forward you to their site.)

    Thanks for the feedback, I hope this helps you and everyone else out!
     
    Accelerated Media, Dec 5, 2007 IP
  4. solidghost

    solidghost Peon

    Messages:
    413
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I don't see anything spammy about this thread, why is there a need to report it?
     
    solidghost, Dec 5, 2007 IP
  5. analytics

    analytics Banned

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i don't think its spammy .. its helpful ! Thanks for sharing !! +ve added ;)
     
    analytics, Dec 6, 2007 IP
  6. Styxbowl20v

    Styxbowl20v Active Member

    Messages:
    231
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #6
    Good info, just to remind people that you can't be on a Windows (IIS) server to use this technique.
     
    Styxbowl20v, Dec 6, 2007 IP
  7. Philopoemen

    Philopoemen Peon

    Messages:
    704
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #7
    A very basic tutorial, however some people fail to implement even these simple 2 lines :)
     
    Philopoemen, Dec 6, 2007 IP
  8. bedmo

    bedmo Peon

    Messages:
    117
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You can also do it from your google webmaster account..
    its very simple
     
    bedmo, Dec 6, 2007 IP
  9. Philopoemen

    Philopoemen Peon

    Messages:
    704
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #9
    That's something else, and as you can probably figure out - that is only for google.
     
    Philopoemen, Dec 6, 2007 IP
  10. sweetfunny

    sweetfunny Banned

    Messages:
    5,743
    Likes Received:
    467
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Never do this in Google Webmaster tools period, always use a server side 301
     
    sweetfunny, Dec 6, 2007 IP