How to test your site using the host file?

The following will guide you on how to set up the host file, which function is redirecting the address to the IP address you intend to host the website, for testing purposes.

WINDOWS OPERATING SYSTEMS

  1. Windows 8 or 8.1
    • Search for notepad in the search function
    • Right click notepad and select “Run as administrator”
    • Once done, open up the following file using File > Open feature
    • c:\windows\system32\drivers\etc\hosts
  2. Windows 7
    • Click on the Windows Start button on the lower left, and Run
    • Type in the following: notepad c:\windows\system32\drivers\etc\hosts
    • Press “OK”

Once the host file is opened up, you can edit the file. In this example we will use 1.1.1.1 as the ip address and www.google.com as the domain.

How to test your site using the host file?

Make sure to save the changes after you are done, now you can test the site on your browser.

MAC OS X (Any version)

As the nameservers are not yet modified, you may use the below steps to cross check the same from your Mac Machine:
1. Launch Terminal, found in /Applications/Utilities/ or launched through Spotlight.

 

2. Type the following command at the prompt:

sudo nano /etc/hosts

 

3. Enter the administrator password when requested, you will not see it typed on screen as usual with the command line.

 

4. Once the host file is loaded within nano, use the arrow keys to navigate to the bottom of the host file to make your modifications.

 

Add the following:
100.100.100.100 domainname.com
100.100.100.100 www.domainname.com

(Note: Replace 100.100.100.100with the actual IP address and replacedomainname.comwith the actual domain name.)

5. When finished, press Control+O followed by ENTER/RETURN to save changes to /etc/hosts, then press Control+X to exit out of nano.

6. Quit out of Terminal when finished.

Note: For the website to work with the actual IP address again, you need to undo the changes you have done in the /etc/hosts.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to replace the Under Construction page of my website?

By default, our system automatically creates a placeholder Under Construction page for you at...

How to access my hosting control panel?

To access your hosting control panel for managing your Website and email, please use the link:...

How to set up cron job in cPanel?

Cron job is a time-based scheduler that allows you to automate certain commands or scripts on...

Differences Between Shared vs VPS vs Dedicated Hosting

Shared vs VPS vs Dedicated Hosting There are three main types of hosting plans available for...

How to set up cPanel app on Android

The cPanel app is now available on mobile devices which can be used for cPanel, WHM, and Webmail...

Powered by WHMCompleteSolution