getting all sundomains to www

Discussion in 'Apache' started by hextraordinary, Mar 14, 2007.

  1. #1
    ok, ive done that a few times before, but now I just can't recall how.

    I want all subdomains of a URL to go to the www version of it, like
    abc.somesite.com & zzz.somesite.com & whatever.somesite.com will all be directed to www.somesite.com.
     
    hextraordinary, Mar 14, 2007 IP
  2. evera

    evera Peon

    Messages:
    283
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine On 
    RewriteCond %{HTTP_HOST} ^.domain\.com$ 
    RewriteRule ^(.*)$ www.domain.com/$1 [L,R=301] 
    Code (markup):
    Havent testet it, but it should work.
     
    evera, Mar 17, 2007 IP