To test your website with your own domain name before DNS propagation has completed, you can use your local computer's HOSTS file. Your computer will use the entries in your HOSTS file before it looks up the DNS information for your domain. This article contains instructions for editing the HOSTS file on Windows 95/98/Me/2000/XP/2003/Vista/7, and Apple's Mac OS X.
When you are finished testing, remember to remove the custom lines that you added.
Cartika is not responsible for custom configurations on your local computer. If you are uncomfortable with editing configuration files on your computer, please do not follow the instructions below.
Filename: hosts
127.0.0.1 localhost
You can add additional lines to this file that will point requests for a particular domain to your new server's IP address. Example:
Filename: hosts
127.0.0.1 localhost 70.32.88.203 example.com 70.32.88.203 www.example.com
ipconfig /flushdns
sudo cp /private/etc/hosts /private/etc/hosts-orig
Enter your user password at the prompt.
Type the following command to edit your hosts file:
sudo vi /private/etc/hosts
Enter your user password at the prompt.
Filename: hosts
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
Add your domain and IP address to the bottom of the file. For example:
Filename: hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
70.32.88.203 example.com
70.32.88.203 www.example.com
4. You may also need to grant yourself sudo priveleges, if you got a permission error in Step 2. In your "Help" menu, search for "root" and select the instructions for "Enabling the root user." Follow these
5. Restart any currently open browsers. You may also want to flush your DNS cache:
Command: dscacheutil -flushcach
6. Visit your new site using http://example.com/ or http://www.example.com/