A set of colourful badges with the "W" from the WordPress logo - and banner text saying: Working with WordPress: Site Migration Tips"
Tools & Tips, Tutorials

Access WordPress Installation without a Domain

Let’s say you’re moving a WordPress site from one host to another. Before changing the DNS settings on the domain you want to migrated the site’s contents and test it rather than make all the changes to a live site. The way to do this is to make a few simple edits to a text file. Here’s how.

Instructions for editing your Host file, to direct your browser to WordPress on the server.

Find your server’s IP address.

Login to your CPanel account. The IP address you need is shown under the heading Shared IP Address in the General Information. Make a note of this.

Navigate to the hosts file and open it with a text editor.

The file, called hosts, is stored in C:\Windows\System32\drivers\etc. You may need to click through a popup asking for Administrator access. Just click Continuewhen prompted.NOTE: If you are trying to open the file from within an application, such as Notepad++, and are not in Adminstrator mode, you won’t see the file. To rectify this, navigate to the file via Explorer then double-click to open it in your text editor.

Update the file.

You will see some intro text describing the purpose of the file and then, at the bottom, some text that includes an IP address and a label, like this: localhostThis is an instruction that says, “when I type localhost into my browser, redirect the request to”We will use this to redirect requests to the domain to your copy of WordPress on the server. Add a new row of text under any other redirects, in the format shown below: X.X.X.X yourdomain.comwhere, X.X.X.X is the IP address you just retrieved from your CPanel account. yourdomain.com the domain you will be transferring to (where WordPress is installed.)

Save the file.

When you’ve finished editing, save the modified hosts file.

And that’s it. Now, when you type the domain into your browser you will access the server-installed WordPress installation. Now you can get this all set up, transferring all the data from your old site to the new server, making sure everything works, before changing the DNS settings on your domain to point to the new host.

But what about when you want to see online version of the site? Well, simply open the hosts file and comment out the edits by adding the # symbol in front of the code, so:

X.X.X.X yourdomain.com
# X.X.X.X yourdomain.com

Now you can test your site on the new server before changing the DNS settings on the domain. No downtime!