Using Separate Host or Domain Names for Website Development on Windows with IIS or Apache Using Hosts File

Whether you run IIS or Apache you can run local sites similar to 'localhost'.

When you type localhost in your browser's address bar and hit enter, the address always translates to the loopback IP address in IPv4, or ::1 in IPv6.

You can easily create similar names which will always translate to loopback IP address or point to any specific IP address of your choice.

Here is what you have to do:

1. Press Windows key + R, the Run... dialog box will appear. - If your keyboard lacks the Windows key, you may click Windows Start button and then click on Run... option in the Start menu.

2. Type drivers and hit enter, the Windows explorer will appear.

3. Now browse to drivers/etc/

4. Open the host file with Notepad application.

You'll see at least on entry inside your host file. Almost all host file contain the following entry: localhost

To add another entry, change your host file in this way: localhost

Save your hosts file.

Try loading from your browser, do NOT add www. You will see that you are hiting Apache or IIS on your own computer.

Now, reopen host file and add one more entry: localhost

Save the file and try to load the new URL from your browser and you continue to hit your local web server.

Another shot: localhost

Save the file and now you can NEVER access the real Yahoo but will see the localhost site from your web server.

Another important aspect: localhost

Save your hosts file. Now whenever you will type on your browser you will be taken to the webserver running on your network computer that has the given IP address of

Bingo, you're ready for the next tutorial on configuring Apache and IIS to serve or show different content when different domain names are passed.

Don't jump into conclusions and remeber that: 1. This will not change the settings of your websites users or anything outside your computer. 2. Just because you added to your host file doesn't make you owner of that domain name. 3. Nobody else can visit your site by typing and until they specifically update their hosts file 4. Don't try to hack into someone else's computer using this concept since you will be caught just too easily and it will be foolish to spend dozens of years in jail for such a simple hack. If you want to serve jail time then it better be some serious hack.


  1. It is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn’t wait to read. I am impressed with your work and skill. Thanks. website designer Miami

  2. Thank you for putting all these strategies into a very readable place. It shows your ability and great skills. keep sharing such article in future. Custom Website Development Services

  3. It is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn’t wait to read. I am impressed with your work and skill. Thanks. Read more info about website development san antonio

  4. You composed this post amazing about this topic. I got data from your article, it is precious for me and furthermore for other people. Continue sharing this sort of information. Website Development Tampa

  5. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. Read more info about Affordable Graphic Designer Singapore

  6. This article provided me with a wealth of information about web design company sydney. The article is both educational and helpful. Thank you for providing this information. Keep up the good work.

  7. You have posted an excellent article. It is all about the Website Development. It is very informative. Website Design And Development Services Australia.Keep sharing.

  8. Excellent post. I really enjoy reading and also appreciate your work. This concept is a good way to enhance knowledge. Keep sharing this kind of articles, Thank you. Web Design Development Company

  9. You have worked nicely with your insights that makes our work easy. The information you have provided is really factual and significant for us. Keep sharing these types of article, Thank you. Website Development Company in India

  10. I liked your work and the way in which you have shared this article here about. website online backup service in canadaIt is a beneficial and helpful article for us. Thanks for sharing an article like this.

  11. You are providing good knowledge. It is really helpful and factual information for us and everyone to increase knowledge. Continue sharing your data. Thank you. Adwords Solutions

  12. The information which you have provided is very good and essential for everyone. Keep sharing this kind of information. Thank you. ecommerce website development services melbourne

  13. The information you've provided is quite useful about iMIS responsive. It's incredibly instructional because it provides some of the most useful information. Thank you for sharing that.

  14. It is what I was searching for is really informative.IT Security Solutions Auckland It is a significant and useful article for us. Thankful to you for sharing an article like this.


Post a Comment

Be relevant. Spammers will be banned.

Popular posts from this blog

Installing ColdFusion on IIS 7 + Configure IIS for ColdFusion in Windows Vista and Windows Server 2008

ColdFusion Manual Configuration & Issues with TCP ports 51011, 51010 and 51800 on IIS and Apache

Configuring Apache Tiles to Avoid Caching During Development