Link to home
Start Free TrialLog in
Avatar of shadow2007
shadow2007

asked on

forwarding cname to vhost

I have vhost setup one tld and a sub domain (since they are in different directories).
ex.
<VirtualHost *:80>
    ServerAdmin webmaster@domain.com
    DocumentRoot /var/www/html
    ServerName www.domain.com
    ErrorLog /var/log/httpd/www.domain.com-error_log
    CustomLog /var/log/httpd/www.domain.com-access_log common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@domain.com
    DocumentRoot /var/www/sub/html
    ServerName sub.domain.com
    ErrorLog /var/log/httpd/sub.domain.com-error_log
    CustomLog /var/log/httpd/sub.domain.com-access_log common
</VirtualHost>

when i use a cname "test.differentdomain.com" to pint to sub.domain.com, the request takes me domain.com ????? can someone help me ?
ASKER CERTIFIED SOLUTION
Avatar of edster9999
edster9999
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You also need to specify :

NameVirtualHost *:80

This is a required statement that enables name-based virtualhosting.

Please refer to Apache's documentation:
http://httpd.apache.org/docs/2.0/mod/core.html#namevirtualhost
Avatar of shadow2007
shadow2007

ASKER

yep i figured that after I posted this :) thanks anyway for the spot on answer :)