fbpx
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

Use the following instructions if you’re running Windows 10 or Windows 8:

1. Click on the Start button or press the Windows key on your keyboard.
2. Type Notepad in the search field.
3. In the search results, right-click Notepad and select Run as administrator.
4. From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
5. 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.
6. Select File > Save to save your changes.
7. Click Start > click Run.
8. Type cmd in the search field.
9. From cmd, type in ipconfig /flushdns then hit Enter.
10. 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.

Use the following instructions if you’re running Windows 7 or Windows Vista:

1. Select Start > All Programs > Accessories.
2. Right-click Notepad and select Run as administrator.
3. The Windows needs your permission UAC window appears.
4. Click Continue to grant permission. Notepad opens.
5. In Notepad, select File > Open.
6, In the File name field, enter the following path: C:\Windows\System32\Drivers\etc\hosts
7. 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
8. Select File > Save to save your changes.
9. From cmd, type in ipconfig /flushdns then hit Enter.
10. Browse using the browser and navigate to http://domain.com (without the www part) and you will be able to view the site without waiting for DNS to resolve.

Use the following instructions if you’re running Windows NT, Windows 2000, or Windows XP:

1. Select Start > All Programs > Accessories > Notepad.
2. Select File > Open.
3. In the File name field, enter C:\Windows\System32\Drivers\etc\hosts.
4. Select Open.
5. 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.
6. Select File > Save to save your changes.

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!