How to put in place a temporary domain for WordPress
There are a number of reasons that you may want to put in place a temporary domain for your WordPress site. Perhaps you’re developing a new site and don’t yet have a domain name, or maybe you’re moving your WordPress site to a new host and want to test the site works before you redirect traffic.
Either way, putting in place a temporary domain isn’t difficult once you know the steps. In this guide I’ll explain how to put in place a temporary domain for WordPress, though you could use the guide as a basis for putting in place a temporary domain for other platforms.
What is a temporary Domain?
A temporary domain is a web-accessible address that allows you to view a website remotely so that you can test that the site functions as you expect. The temporary domain can either be a main domain, or a subdomain. If you have an account with Clook, we can put in place a temporary domain for you
How to create a temporary domain
Putting in place a temporary domain is as simple as changing the domain or subdomain’s IP address, to match the IP of the server that has the web content on that you want to view. For Clook customer’s this is even easier. All you need to do is login to cPanel and click the temporary domain link.
How to configure WordPress to use a temporary domain
You’ve probably just tried to load your WordPress site after creating the temporary domain and been redirected to the main site… don’t worry that’s expected. In order to get the WordPress site working with a temporary domain, you’ll need to configure WordPress to use a temporary domain. To do this is relatively simple, all you need to add is two lines of code to your wp-config.php file.
Simply open up wp-config.php which is located in your root web directory. For Clook customers, this is typically in the public_html directory, unless you have installed WordPress under an Addon Domain. Once you have the file opened, simply add the following under the opening php tag:
define( ‘WP_HOME’, ‘https://your.temporarydomain.tld’ );
define( ‘WP_SITEURL’, ‘https://your.temporarydomain.tld’ );
e.g. if your temporary domain is mytempdomain.co.uk the top of your wp-config.php file would look like this (the opening php tag is already present, insert the two lines immediately below that):
define( 'WP_HOME', 'https://mytempdomain.co.uk' );
define( 'WP_SITEURL', 'https://mytempdomain.co.uk' );
Test that the temporary domain works
You can now test that the site loads using the temporary domain. Make sure you’ve cleared all your cache before doing so.
Did you know…
At Clook, one of our specialisms is providing WordPress hosting, if you’d like to find out more, please get in touch with us.
Will’s our technical sales guy from the hills of Rossendale. In his spare time he can be found designing and building websites, or doing a spot of DIY!