Forum Moderators: phranque

Message Too Old, No Replies

newbie virtualhost question

apache virtualhost

         

thefatbrain

9:13 am on Feb 5, 2012 (gmt 0)

10+ Year Member



my website is named www.example.com. I have setup A record for this server in DNS record.
the default document root is /var/www/html

I also setup 2 CNAME record in my DNS

111.example.com
222.example.com

What i wanted to do is when someone refer to [111.example.com...] i want to bring them to document rot /var/www/html/111

when someone refer to [222.example.com...] i want to bring them to document root /var/www/html/222

this is my virtualhost record in httpd.conf

<VirtualHost *:80>
ServerName 111.example.com
DocumentRoot "/var/www/html/111"
</VirtualHost>

<VirtualHost *:80>
ServerName 222.tryaws.com
DocumentRoot "/var/www/html/222"
</VirtualHost>

Now, no matter the incoming URL is www/111/222.example.com, they all are pointed to /var/www/html/111 as the document root...

can someone please give me a helping hand?

penders

10:06 am on Feb 5, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



ServerName 222.tryaws.com


?

I don't think the argument to DocumentRoot should be surrounded in double quotes?

...no matter the incoming URL is www/111/222.example.com


This doesn't look like a valid URL?

thefatbrain

3:27 pm on Feb 5, 2012 (gmt 0)

10+ Year Member



hi i just meant www.example.com/111.example.com/222.example.com

lucy24

10:35 pm on Feb 5, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Did you mean that even if you input a garbage (sub)domain name, it is handled as 222.example.com if the name contains the element "222.example.com" ?