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 http://toto-share.com).
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 :
# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. 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
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# 22.214.171.124 rhino.acme.com # source server
# 126.96.36.199 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
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 http://toto-share.com. So, I can typed http://toto-share.com 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.