Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Internal websites using Host Header Names without DNS

IIS5

Internal websites using Host Header Names without DNS

by  stevewasiura  Posted    (Edited  )
I develop websites at my home office, then upload them to the production webserver when they are done.

I needed to mimic the exact setup of the production webserver, but I don't have a dns machine. My ISP provides DNS, so I couldn't add to their records, and I didn't want to setup DNS on my development "do-it-all" test machine.

So I needed to reference these websites by a root level domain name, instead of a folder under localhost, to ensure that functions that checked the URL for folder names would display the correct menu selection, etc.

I also needed to create vitual directories to use the server side include feature in ASP
<!--#Include Virtual="include/header.asp" -->

Step 1. Search for a file on your computer called HOSTS
I found mine in c:\winnt\system32\drivers\etc
Step 2. Open this file in notepad. At the end of the file you should see an entry that looks like this
127.0.0.1 localhost

that means that if you type localhost in your web browser, it will connect to your local copy of IIS and display the page in your c:\inetpub\wwwroot\ folder

add a line to the bottom of the file for the internal site you wan to connect to. Since this is an internal site, and I don't want it to conflict with my browsing of the "real" public website, I use the domain suffix ".int". Here is my example:
127.0.0.1 MySite.int

Save the file from notepad, without any extension, "HOSTS"


Step 3. Open IIS Mgr
Add a new website, and specify it to use the host header name, in this example "MySite.int"

Test it by opening your web browser and typing "MySite.int" into the address bar, it should connect to the website files specified when you created the website in IIS



Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top