You’ve just moved your website to WPX, but you don’t know how to check it without pointing it to WPX? No worries, in this article we will show you how you can preview and even develop your website without pointing the domain to the new server.
But before that, let’s define what is the Hosts File, and its purpose.
What is a Hosts File?
The Hosts File is a local file that maps domain names to IP addresses. It’s contained in each operating system (Linux, macOS, Windows, etc.). And basically, it’s overriding your integrated DNS client. So, every time you visit a website, your computer will check the hosts file first to see which IP address it connects to and load it.
In short, by editing the Hosts file, you’ll be able to open your website locally.
The purpose of Hosts File?
As you know, for your website to start loading from the new server after moving it to WPX, there will be a DNS propagation time which can take up to 48 hours. In some rare cases, it can take up to 48 hours. During that time, your website will load for the public but it is not recommended to make changes to it because those changes may not be saved on the new server.
That’s why editing the Hosts file is useful if you want to modify or just check your site after moving it to the new hosting and see how it’ll look without pointing the domain.
Another example, of why you can use the Hosts File, is when you are developing your website and you need to see the new content you’ve made without clearing all the cache (server, browser, and plugin) after you made a new change. (OR without changing the DNS records for the public).
How to edit the Hosts File?
Step 1. Log in to your WPX account.
You can log in to your WPX account here.
Step 2. Navigate to your hosting plan.
You can either find your hosting service through the navigation menu or within your dashboard. Once you log in to your WPX account select My Services (1) → WordPress Hosting (2).
Then you will see all of your hosting services with us. You need to select the orange button Manage service for the service that is located on your website, which you’re going to view without pointing it.
Step 3. Copy the Server IP Address
Now, copy the Server IP Address, you will need it for later while editing the hosts file.
Step 4. Open Terminal
Use the Command ⌘ + Space keyboard shortcut, once the Spotlight search field appears in the middle of your screen, please type Terminal and open it.
Step 5. Open the hosts file
To open the hosts file, enter the following command:
sudo nano /private/etc/hosts
Once you type in your password, you will be directed to the hosts file.
Step 6. Add your domain to the hosts file
At the bottom of the file, insert your Server IP Address, followed by a space, then your non-www and www version of your domain name.
Step 7. Save the changes
To save the changes, press CTRL + O. Then launch your browser and navigate to the domain you inserted into your hosts file.
If you get stuck with anything discussed on this page, please contact WPX Support via live chat (use the bottom right-hand widget) and they will respond and help within 30 seconds or less.