Call us +1-231-421-7160

Using the Hosts File During a Domain Transfer

If you want to continue with working on your Joomla or WordPress site while you have just made a domain change and the DNS records are propagating, you can do that by adjusting the hosts file. Here's how you do it (please keep in mind that the IPs here are just examples - to get the exact IP of the server your instance is on, please submit a support ticket). This article contains instructions for different operating systems.

Windows

Linux

Mac OS X

Windows

  1. (For XP Users) Start -> Run(For Vista / Windows 7 Users) Start -> All Programs -> Acessories -> command (Right click and open as administrator) Type in c:\\WINDOWS\NOTEPAD.EXE c:\\WINDOWS\SYSTEM32\DRIVER\Setc\HOSTS
  2. In the opened notepad type in 71.89.140.14 domainname.com (the domain name which you want to test without www ) for eg.71.89.140.14 domainname.com
  3. Save the file.
  4. Start -> click Run -> cmdtype inipconfig /flushdns
  5. Browse using the browser and navigate to http://domainname.com  (without the www part) and you will be able to view the site without waiting for DNS to resolve.

Linux

  1. Execute sudo gedit /etc/hosts.
  2. In the opened notepad type in 71.89.140.14 domainname.com (the domain name which you want to test without www) and save the file
  3. Execute sudo /etc/init.d/apache2 restart
  4. Browse using the browser and navigate to http://domainname.com  (without the www part) and you will be able to view the site without waiting for DNS to resolve.

Mac OS X

  1. Open the Terminal.app either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.
  2. Open the hosts file
    • Open the hosts by typing on the Terminal that you have just opened:
    • $ sudo nano /private/etc/hosts
    • Type your user password when prompted.
  3. Edit the hosts file
    • The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 localhost).
    • Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing!
    • You can navigate the file using the arrow keys.
  4. Save the hosts file
    • When done editing the hosts file, press control-o to save the file.Press enter on the filename prompt, and control-x to exit the editor.
  5. Flush the DNS cache
    • On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:
    • $ dscacheutil -flushcache
    • You can now test your new mapping on the browser!

Do you have suggestions for improving this article?  

We take a great deal of pride in our knowledgebase and making sure that our content is complete, accurate and useable. If you have a suggestion for improving anything in this content, please let us know by filling out this form. Be sure to include the link to the article that you'd like to see improved. Thank you!