Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>
share|improve this question
    
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
add comment

5 Answers

up vote 1 down vote accepted

Try to delete the trailing slash on the ServerName lines.

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

Or give the full path to the folder:

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

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

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

share|improve this answer
add comment

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

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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