Change Hostname in Windows

I am create website in my local computer (I use Windows 7) before update to website (in internet). I use Xampp as web server. By default, after we activate Xampp (use apache, php, and mysql package active), we can browse our local site by type http://localhost in my favorite browser. But this name is not same with our website name in internet. So, I search a method how to change hostname in windows. So, we can show our site in local like our website in internet (ex. like

We can change hostname in windows by editing host file in windows. Open at your windows location. For my example, my windows installed at C:\. So, we can get host file in location : C:\Windows\System32\drivers\etc\hosts. Open this file with your favorite text editor. In my computer, this is original content for this file :

If You want to create new hostname for your computer, you can add new line to this editor. Example, I want to change my default localhost with So, I can typed than http://localhost in my local computer. So I can add this line in the last text file :

From this method, you can change hostname in windows. I think this is a simple method how to change hostname in windows with default http://localhost with your favorite hostname.

Add a Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.