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.

my windows 7 hosts file has this...

127.0.0.1     www.testing.com
127.0.0.1    testing.com

and my apache http-vhosts.conf file has this...

<VirtualHost *:80>
DocumentRoot "E:/Server/htdocs/myframework"
ServerName testing.com
ServerAlias www.testing.com
</VirtualHost>

It almost works as I want it except it is wrong.
Now when I go to "testing.com" or "www.testing.com" it does load the "E:/Server/htdocs/myframework" page as I want it to, however now when I got to "localhost" it always loads "E:/Server/htdocs/myframework" instead of localhost/the-directory-i-want or file i want

Anybody know why or better, how I can make it work how I would expect it?

share|improve this question

closed as off topic by Iain, Scott Pack, freiheit, Ward, sysadmin1138 Dec 17 '12 at 3:28

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 3 down vote accepted

If you only have that one vhost set up then it will serve eveything. You could set up a localhost vhost

<VirtualHost *:80>
    DocumentRoot "E:/Path/To/localhost"
    ServerName localhost
    ...
</VirtualHost>

Also Your hosts file can have the hosts all on one line

127.0.0.1 www.testing.com testing.com localhost
share|improve this answer
    
thanks for the response and the tip on the 1 line for hosts,however, I have tried this and it still routes everything E:/Server/htdocs/myframework instead of E:/Server/htdocs/ ... any other ideas? And yes I restarted Apache, thanks again –  jasondavis Aug 11 '11 at 21:23

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