HTACCESS for redirecting .org/net to .com and non-www to www?

Discussion in 'Apache' started by Daniel591992, Oct 11, 2008.

  1. #1
    Daniel591992, Oct 11, 2008 IP
  2. seismic2

    seismic2 Peon

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    "http://example.org" and "http://example.net" point to the same host? I mean they are configured as parked domains, right?
     
    seismic2, Oct 11, 2008 IP
  3. Daniel591992

    Daniel591992 Well-Known Member

    Messages:
    594
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    125
    #3
    Yes they are
     
    Daniel591992, Oct 11, 2008 IP
  4. seismic2

    seismic2 Peon

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    In that case it's pretty simple :
    RewriteEngine On
    Options +FollowSymlinks
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(www\.)?example\.org [OR,NC]
    RewriteCond %{HTTP_HOST} ^(www\.)?example\.net [OR,NC]
    RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
    RewriteRule (.*) http://example.com/$1 [R=301,L]
    Code (markup):
    Untested, but it should work.
     
    seismic2, Oct 11, 2008 IP
    Daniel591992 likes this.
  5. Daniel591992

    Daniel591992 Well-Known Member

    Messages:
    594
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    125
    #5
    It worked. THanks a lot
     
    Daniel591992, Oct 12, 2008 IP
  6. nadlerz

    nadlerz Well-Known Member

    Messages:
    264
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    188