Will "the Mighty" Strohl

HOW TO: Use Localhost With an Actual Domain Name

First of all, you will need to be running Windows and have your system configured to have and run IIS.  After that, the rest is cake...  The first thing we need to do is determine what URL you want to use.  In our example here, I will choose to use "www.anywhere.com"

Go into IIS, and enter the properties for your site.  Unless you are running a server instance of Windows, you will only have a single site.  Right click on it to get to the site properties.

In the "Web Site" tab, click the "Advanced" button.

Click the "Add" button to add an identity to the site.  Enter the port as number 80, and then enter the URL into the "Host Header Name" field.  (Please note that you might want to repeat this step if you intend on not using the "www." in the URL.)

Click OK to exit out of all of the dialogs and to save your changes.

Go into your system32 directory.  This is either found in the WINDOWS or WINNT directory on your hard drive.  Either way, continue to the following directory.


Within this directory, there is a file named "hosts".  Make a copy of this file to use as a backup in case you mess something up somehow.

Now, open up the hosts file using NotePad.  Add the following lines of text to the file and save your changes. anywhere.com  # localhost alias www.anywhere.com # localhost alias

That's it!  Your site should already be responding to requests made to the anywhere.com domain.  On small occasions, you may have to restart IIS, or clear your local DNS cache.  Otherwise, your site is ready to use the domain name locally. 

blog comments powered by Disqus