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 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
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

127.0.0.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 :

127.0.0.1 toto-share.com

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 *