OK I have been battling this for a week,

I have Xampp running on my home server and I am trying to get subdomains to work, I edited my windows host file so that all of these load my site,

http://localhost/ http://mydomain.com/

http://images.mydomain.com/ http://images.localhost/

I then modified my Apache conf file to add my virtual host to make the images.mydomain.com and images.localhost to load up my localhost/images folder but for some reason they load the contents of http://localhost/ as if I am going to the regular site and not a subdomain, any idea why?

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /htdocs/images/
    ServerName images.localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /htdocs/images/
    ServerName images.mydomain.com/
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /htdocs/
    ServerName mydomain.com/
</VirtualHost>
link|improve this question

74% accept rate
You didn't include the 'http://' in your hosts file, did you? – innaM Jul 30 '09 at 9:09
no serrverfault filters changed those into links on me – jasondavis Jul 30 '09 at 10:09
feedback

5 Answers

up vote 1 down vote accepted

Try to delete the trailing slash on the ServerName lines.

link|improve this answer
yeah I did that but no luck either – jasondavis Jul 30 '09 at 10:11
feedback

Or give the full path to the folder:

DocumentRoot c:/htdocs/mydomain ServerName mydomain.com/

link|improve this answer
yes I added full path and restart apache but no luck – jasondavis Jul 30 '09 at 10:10
feedback

What happened if you ping to images.mydomain.com? Do you obtain a response from your server?

link|improve this answer
feedback

I think you forgot to add " to DocumentRoot. You should try something like this DocumentRoot "/htdocs/images/"

link|improve this answer
feedback

Did you fill your /etc/hosts with the entry images.localhost ?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.