Knowledgebase
How to preview or develop a Wordpress site before changing DNS?

Are you trying to either develop a new website or transfer a site that uses Wordpress as Content Management System (CMS)?  The challenge is that Wordpress uses your domain name throughout the installation and unless you are ready to transfer the domain, it can be difficult to view your new site.  To make matters more complicated, CMS tools like Wordpress will have the domain name stored as a setting in their configuration and they use that setting a lot.  You can setup the site fine on a subdomain or test domain, but you'll have to do some extra work when you want to switch the site over to use the main domain name.  WordPress.org has some great instructions for how to move to a new domain.  Or, if you want to skip the extra work, just build the site like normal and use the technique below so that you can finish the CMS customization before changing your name servers.

Changing your hosts file

A trick to view your site before changing your nameservers to point to Osiris Communications is to temporarily edit your hosts file to force your computer to view the Osiris-hosted version.  After creating your Osiris account, open the hosts file in your computer (details below).  You'll need to get the IP address assigned to your domain.  You can view this information by logging in to your Hosting Control Panel and viewing the details for your particular domain name.  Copy that IP address.  Now add the following line to bottom of the hosts file, substituting the 192.168.1.1 address below with the one that you just wrote down, and 'example.org' with your actual domain.

192.168.1.1 www.example.org example.org

Do not forget to remove that line from the hosts file once you point your domain's name servers to Osiris or if you want to view the old site.

What happens with this trick is that your system no longer resolves the name to the IP address via your ISP's DNS but instead looks it up from your local hosts file.  This bypasses your ISPs DNS completely for your domain.  The server at Osiris will receive the incoming connection with the correct domain name in the URL and it will serve you the pages.  Keep in mind that only people that have made this modification will be able to access your domain as hosted on Osiris Communications prior to pointing your name servers to us.

 

Locating your hosts file

Windows

On most Windows systems you can find the hosts file in C:\Windows\System32\Drivers\etc.  It might be set to hidden so make sure you have 'show hidden files' turned on in your folder settings.  Save the hosts file and restart your browser and try accessing your domain.  If all is well, you should be able to access your site.  If you are getting a permissions error trying to save the hosts file, simply start your editor (Notepad, Wordpad, or something else) by right-clicking the application and "Run as administrator".

Linux

On most Linux-based systems, the hosts file can be located in the /etc/ directory.

The hosts file is usually called 'hosts' there.  The full path is '/etc/hosts'.  You may need to become the root user (via sudo) in order to modify that file.

Apple Mac OS

  1. Launch Terminal, found in /Applications/Utilities/ or launched through Spotlight.
  2. Type the following command at the prompt:
    sudo nano /private/etc/hosts
  3. Enter the administrator password when requested.  You will not see it typed on the screen as usual with the command line.
  4. Once the hosts file is loaded within nano, use the arrow keys to navigate to the bottom of the hosts file to make your modifications.
  5. When finished, hit Control+O followed by ENTER/RETURN to save changes to /private/etc/hosts, then hit Control+X to exit out of nano.
  6. Quit out of Terminal when finished.
  7. Finally, restart your browser and try accessing your domain.
(4 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments: