0

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>
Chopper3
  • 101,299
  • 9
  • 108
  • 239
JasonDavis
  • 2,658
  • 6
  • 25
  • 32

5 Answers5

1

Try to delete the trailing slash on the ServerName lines.

Philippe
  • 293
  • 1
  • 7
0

Or give the full path to the folder:

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

0

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

lg.
  • 4,649
  • 3
  • 21
  • 20
0

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

0

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

penkoad
  • 51
  • 2