Overwrite DNS to test your new Drupal site before going live

Submitted by admin on Wed, 02/14/2018 - 18:08
Overwrite DNS to test your new Drupal site before going live

It is sometimes useful or necessary to overwrite DNS records.  The ability to do so is particularly helpful when you need to test a new website or a redesigned website before DNS record changes takes effect.  Other uses for modifying host files is to test a website without the test link prior to going live with SSL or and for other DNS-related reasons.

By modifying your host file, it tells your local machine to look directly at the site’s IP address instead of the website’s DNS records.

How to modify your local host file

Step 1: Find it

The first thing to do is to locate the local machine’s host file.  In Windows the host file is normally located at c:\Windows\System32\Drivers\etc\hosts.  You will have to open the host file in Notepad run as a system administrator. (See also instructions for Mac OS and Linux)

Step 2: Modifying the host file

To modify the hosts file, two elements are required, the website’s IP address and the URL.  For example:

64.49.219.194 www.domain.com

64.49.219.194 domain.com

Save the host file and that’s it!