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

I have configured my website from VS2010 to use IIS 7.5. Then I added this line to my hosts file:

127.0.0.1 something.com

This correctly goes to IIS 7.5 default screen

However I want this to go to my website that is hosted in IIS 7.5. So I changed the above line to:

127.0.0.1/MyWebSiteHostedinIIS something.com

But when I did this it stopped working. Any ideas what am I doing wrong and how can I correct this?

share|improve this question

closed as not constructive by John Gardeniers, Ward, rnxrx, HopelessN00b, Scott Pack Sep 26 '12 at 13:41

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
read at least once hosts file format description, inside host file!!! –  Lazy Badger Oct 10 '11 at 6:28
    
I read that. "The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space.". But I basically wanted how to solve this problem. –  Bob Lee Swagger Oct 10 '11 at 6:30

1 Answer 1

up vote 1 down vote accepted

YOu know, windows does not care what you want until you actually do it according to specs.

Since more than 20 years - ever since the hsots file was invented for unix - there is a spec what it does and a way how it works.

Putting folders into it WONT WORK.

Hosts does DNS resolution. DNS does not know about folders, even if that would be convenient for you. Host maps host names to IP addresses.

127.0.0.1/MyWebSiteHostedinIIS

is not an IP address.

Ergo it doesn ot work.

What you want can not be done. Point. Use the IIS 7 hosts header feature to do it.

I.e.:

127.0.0.1 something.com

in the hosts file

and in the IIS configuration tell it that something.com maps to a specific location.

share|improve this answer
    
Ok thanks TomTom.Can you tell where do I configure something.com maps to a specific location? Any links? –  Bob Lee Swagger Oct 10 '11 at 6:31
    
Google? Here is ServerFault, not Google –  Lazy Badger Oct 10 '11 at 6:52
    
@Lazy: If you don't know or don't want to answer why bother commenting on somebody else's post? Why not let others help? What do you want me to type in Google? "IIS configuration"? Do you think that will yield me correct results to what TomTom is talking about? –  Bob Lee Swagger Oct 10 '11 at 6:55
    
Site mappings. In the site mappings you can say for every site what host header it reacts to - and in the site setup where to look for it's files. –  TomTom Oct 10 '11 at 6:59

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