rewrite www subdomain

Discussion in 'Apache' started by gashbaugh, Oct 25, 2005.

  1. #1
    Hi:

    I notice there are several rewrite questions, so here's another one.

    I want to rewrite:

    http://www.mysite.com/dir

    to go to:

    http://mysite.com/dir

    Thanks! :)
     
    gashbaugh, Oct 25, 2005 IP
  2. jazzle

    jazzle Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    no-www.org will show you how.

    but for the lazy: ;)
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
    Code (markup):
     
    jazzle, Oct 26, 2005 IP
  3. gashbaugh

    gashbaugh Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply. I actually don't want all the traffic done like that. Only specifically I want: http://www.mysite/dir directed to http://mysite/dir.

    The dir is the part I'm really going after here in this instance.

    I have a feeling that something like this is wrong:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.mysite\.com\dir$ [NC]
    RewriteRule ^(.*)$ http://mysite.com/dir/$1 [R=301,L]

    Thanks Again.
     
    gashbaugh, Oct 26, 2005 IP