Search

How to Test a WordPress site on a temporary address before migrating to a new server

If you are transferring a WordPress site from one hosting company to another, it is advisable to make sure the site is working properly on the new server before changing the domain’s nameservers. For example, if you migrated your site from company X to a hosting server I recommend, you can ensure that your site looks exactly the same before you point your domain to the new server.

Before we continue, I should mention that there is an even smarter way to do this without using the temporary URL at all and without editing the wp-config.php file at all. You can change the hosts file on your local computer to point your domain to the IP address of the new server.

I wrote a separate post about this, take a look at the post How to Test Your Site on a New Server Before DNS Change, take a look if you prefer to check your site this way. This method is even more recommended than the method described in this post.

In any case, in this post we will see how to set up and access WordPress using a temporary URL..

How to Find the Temporary URL?

You can find the temporary URL in the email you received when you signed up with the hosting company. Additionally, if you are on any reseller plan, you can find the temporary URL by viewing the IP address listed in your account list in WHM. Usually, this address looks like this:

https://IPADDRESS/~yourusername

So if your IP address is 1.2.3.4 and your username is “username”, then the temporary address of the site on the server would be in the following style:

https://1.2.3.4/~username

How to Configure WordPress to Use the Temporary URL?

Since WordPress stores the domain name in the database, it will not “automatically” work with any URL unless you manually change the settings for this address.

After you have migrated the site to the new server, whether a manual migration or migration using a plugin such as Duplicator, go to your cPanel account and open the “File Manager”.

You can also edit this file using FTP.

cPanel File Manager

Go to the main folder where WordPress is installed and find the file wp-config.php.

Go to the main folder where WordPress is installed and find the file

Right-click this file, choose Edit and confirm the edit. Now look for the lines containing WP_HOME and WP_SITEURL.

If you don’t find these you will need to add them yourself.

The lines we are talking about look like this:

define('WP_HOME', 'YOURDOMAINNAME');
define('WP_SITEURL', 'YOURDOMAINNAME');

Now change the address in each of these lines to the temporary address of your site and save the changes. After the change it will look something like this:

define('WP_HOME', 'https://IPADDRESS/~yourusername');
define('WP_SITEURL', 'https://IPADDRESS/~yourusername');
Change HOME_URL & SITE_URL

Basically, we are done, you can access and see your WordPress site at the temporary site address. After you have confirmed that your site looks appropriate, you can change those lines in the wp-config.php file so that they reflect the real domain and change the nameservers as they point to the new site.

Roee Yossef
Roee Yossef

I develop websites & custom WordPress themes by design. I love typography, colors & everything between, and aim to provide high performance, seo optimized websites with a clean & semantic code.

0 Comments...

Leave a Comment

Up!
Blog