How to view your GreggHost site using your hosts file?

The affects of Web Hosts on Your Business Website

Here're ways your choice of web hosting service provider impacts the performance of your business:


check

Website loading speed

check

Uptime and availability

check

Customer support

check

Security

check

Server location

How to view your GreggHost site using your hosts file?

How to view your GreggHost site using your hosts file?

Overview

On your home computer, a host file is a text file. It’s used to associate a domain name with a particular server. You can modify where your computer looks for a webpage if you edit it.

When you type a URL into your browser, for example, your computer makes a query to the Internet to determine where your site is situated. Your website is hosted in the location where your DNS is directed. You can alter where your computer looks for a website by editing the host file.

When the DNS is pointed to another business, you can still visit a site hosted on your GreggHost server.

This article covers how to access your site on your desktop or laptop computer before pointing your DNS to GreggHost by modifying the host file (not a mobile device).

Visit the following article to test your site on a mobile device or for another alternative on how to view your site at GreggHost before pointing DNS:

Before changing DNS, test your site with a dreamhosters.com subdomain.

Locate your A records

At GreggHost, each site has two A records for the URL. One for your domain with www and one for your domain without www. Consider the following scenario:

example.com 208.113.137.245
www.example.com 208.113.137.245
For more information on how to examine these records, see the DNS article. Make a note of these since you’ll need them in the next step to add the IP to your hosts file.

Using Windows 7 & 8.1

The hosts file is located in the following directory on most Windows systems:

C:\Windows\System32\Drivers\etc
If it’s set to hidden, make sure that’show hidden files’ is enabled.

Notepad is a simple text editor that comes pre-installed in Windows. Follow the instructions below to open the hosts file in Notepad:

Activate the ‘Start’ menu.
01 is the location of the Windows.png file.
Type ‘notepad’ into the search box.
Choose ‘Run as administrator’ from the right-click menu for the ‘Notepad’ option.
This creates a new Notepad document.
Click the ‘File > Open…’ menu option in the top left corner of this blank file.
02 is the location of the Windows.png file.
Navigate to the C:WindowsSystem32Driversetc directory in the Explorer window.
Open the hosts file by selecting it.
Add your GreggHost site IP followed by the domain at the bottom of the file.
example.com 208.113.137.245
208.113.137.245 www.example.com
Save the document.
Finally, flush your computer’s DNS to guarantee that the new changes take effect.
DNS Cleanup
Try accessing your domain after restarting your browser.
You may now see how your site looks on the GreggHost server. These lines can be removed after your DNS is pointed to GreggHost.

Using Windows 10

The hosts file is located in the following directory on most Windows systems:

C:\Windows\System32\Drivers\etc
Notepad is a simple text editor that comes pre-installed in Windows. Follow the instructions below to open the hosts file in Notepad:

Activate the ‘Start’ menu.
View the Windows10 01.png hosts file.
Start typing the term ‘notepad’ and the icon will appear.
View the Windows10 02.png hosts file.
Choose ‘Run as administrator’ from the right-click menu for the ‘Notepad’ option.
“Do you want to enable this app to make changes to your PC?” a pop-up notice labeled “User Access Control” may appear. Yes should be selected. This creates a new Notepad document.
Click the ‘File > Open…’ menu option in the top left corner of this blank file.
02 is the location of the Windows.png file.
Navigate to ‘This PC’ in the ‘Explorer’ window. Then navigate to the C:WindowsSystem32driversetc folder.
all-files dropdown in notepad
Open the hosts file by selecting it. You may need to change the “Text Documents (*.txt)” selection option in the lower right to “All Files.”
Add your GreggHost site IP followed by the domain at the bottom of the file.
example.com 208.113.137.245
www.example.com 208.113.137.245
Save the document.
Finally, flush your computer’s DNS to guarantee that the new changes take effect.
DNS Cleanup
Try accessing your domain after restarting your browser.
You may now see how your site looks on the GreggHost server. These lines can be removed after your DNS is pointed to GreggHost.

Using Apple Mac OS

These lines can be removed after your DNS is pointed to GreggHost.

Using Apple Mac OS, enter Terminal by pressing command () + spacebar, which will bring up a search box.
04 hosts.fw.png DNS
Type the term Terminal into the search box.
Under TOP HIT, press the return key or click the Terminal button.
06 hosts.fw.png DNS
Instructions on how to edit this file may be found in the article Creating and editing a file over SSH. The nano editor is used in this example.
07 hosts.fw.png DNS
In your terminal, type the following:
sudo nano /private/etc/hosts [server]$
Enter the password for the administrator. Passwords typed in the command line are not shown.
08 hosts.fw.png DNS
Use the arrow keys to travel to the bottom of the hosts file to make any necessary changes.
To return to your terminal prompt, save and close the file when you’re done.
Finally, after you’re done, close Terminal.
To guarantee that the new changes take effect, flush your DNS. These lines can be removed after your DNS is pointed to GreggHost.

Using Linux On most Linux-based systems, you can do the following:

In the /etc/ directory, you’ll find the hosts file.
The hosts file is commonly referred to as hosts.
/etc/hosts is the complete route.
To change and save the file, follow the methods outlined in the ‘Mac OS’ section above.

Move WordPress instructions

If your WordPress site was relocated by the Professional Services Team, this section explains how to access it (at GreggHost). This section only relates to migrations that aren’t GreggPress-based.

To locate and edit your computer’s hosts file, first read through the sections above.

In most cases, upgrading a hosts file just necessitates the addition of two lines (as mentioned above). You’ll also need to add a third line of text for the MySQL server as part of this migration process. If your site was example.com, for example, you’d add the following lines to the bottom of your hosts file:

example.com 111.111.111.111
www.example.com 111.111.111.111
222.222.222.222 mysql.example.com
Replace the example IP addresses with the IP addresses of your site. They may be found on the Manage Domains tab of the GreggHost web interface. Click the DNS link under your domain name.

View the ‘DNS’ article for more thorough information on locating your site’s IP addresses if you need more help.

Verifying that the ‘hosts’ file is operational
If you can load the following page (replace example.com with your domain), you are loading the migrated site from GreggHost’s servers.

http://example.com/quickstart.html
Use a proxy to access your public website.
Your computer will display you how your site looks at GreggHost once your hosts file is working. You’ll need to use a proxy website if you want to see your current (public) site as well.

Kproxy.com is an example of a proxy site. In your browser, go to that link and type your domain name into the box, then hit Enter. To access the site at your current hosting company, it uses your site’s public DNS (rather than your local hosts file).

contrasting the websites
When you browse your site using a hosts file and a proxy site, you can compare the two versions of your site side by side. To see your current public site, you can have one browser tab open on the migrated site (viewed using your hosts file) and another browser tab open on the proxy site (viewed using DNS).

Adding more changes to your website
During your site inspection, you may feel compelled to make changes to something that was not covered by the migration service. Please don’t make any changes that might change the site’s appearance or behavior, as the Professional Services Team will need to compare the migrated site (at GreggHost) to the live site (at your current host).

If you need to make a modification, make sure to document it so the Professional Services Team can distinguish between what was affected by the migration and what was affected by subsequent changes on your end.