Subdomain and www.subdomain to directory

Discussion in 'Apache' started by shawnbot, Mar 12, 2008.

  1. #1
    Need help to finish off this solution:

    I'm running a domain with serveral subdomains. Each subdomain already has a proper DNS entry. I have this partially working with:

    ServerAlias *.domain.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www.* [NC]
    RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com
    RewriteCond /var/www/vhosts/domain.com/httpdocs/%1 -d
    RewriteRule ^(.*) /%1/$1 [L]

    example.domain.com will correctly point to the dir /var/www/vhosts/domain.com/httpdocs/example

    I also need www.example.domain.com to point there AND for webmail.domain.com to NOT point to /var/www/vhosts/domain.com/httpdocs/webmail

    Please help!
     
    shawnbot, Mar 12, 2008 IP
  2. Isaak

    Isaak Guest

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    - Ignores: www.domain.com and webmail.domain.com
    - foo.domain.com will point to /var/www/vhosts/domain.com/httpdocs/foo
    - www.foo.domain.com will point to /var/www/vhosts/domain.com/httpdocs/foo

    I have not tested this so tell me if you are having any problems or comments
     
    Isaak, Mar 12, 2008 IP