If you’re a WordPress developer/designer, especially a freelance developer, you know how beneficial it is to develop a site while it’s live. Not only is it helpful when debugging plugins/themes/etc…but it’s great to be able to give your clients a URL that will allow them to access the live site and view it for review purposes. Not only that, it’s awesome to be able to check a live site on a mobile phone and tablet too.
Did your client purchase hosting somewhere else for the new website? Cool, hopefully it was SiteGround WordPress Hosting. Now how do you develop new a WordPress website without any downtime of the current website? Easy, there are many ways to do it, but today I’m going to show you my general process to create a temp url when developing a website on the new server.
New Way (Siteground Hosting changes in 2020)
2020 Update for Siteground
New siteground panel
If you connected a domain name follow these steps
Create New Website
install empty website
go back to panel
go back to websites
delete the current website
make a new website
create a tempory domain
Create empty site (we don’t need the domain currently, but we nneed to finish the installation, so creating this empty site would take less time thann installing WP on it)
2. Deleting the site – so that we can later rename the temporary domain to the live site after you are satisfied and point the DNS
my.siteground.com > Websites > Manage (on the site if you have more than one) > 3 dot menu > Change Primary DOmain
OLD WAY (can be used for some hosting evironments)
1. Install WordPress using the any domain name available during the installation process. Usually with apps like softaculous, they make it easy to setup and install right on the server in your chosen location. If it’s a new server and the only website, I like to install right on the root.
Afterwards you will have to configure the WordPress application with the temporary URL(which is either the shared IP or the server hostname).
2. After you have setup FTP, got to phpMYadmin and find the wordpress options table and replace siteurl and home with the new temp URL you want to use. You may want to use the IP address of the server you are on. So for example http://818.555.342.341/~newurl
3. Open .htaccess via FTP and find the following code in your file
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
Now it should be changed to reflect the rewriting of the new URL:
RewriteEngine On RewriteBase /~newurl/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /~newurl/index.php [L]
Now open your website with the new temp domain you created. Build your new website and point the nameservers when your all done.
These are the steps I take when creating a temp URL for a client on a new server. When using an existing server, I just install WordPress in a subfolder and develop that way. It’s super easy to replace the current website on the root with the new website when ready.
Alternatively, you can force WordPress to read a new domain a couple different ways, but it may or may not work for everyone depending on their hosting environment and how they have setup everything. https://codex.wordpress.org/Changing_The_Site_URL
Adding this code to the functions.php file of the theme or child theme that is currently active.
update_option('siteurl','http://818.555.342.341/~newurl'); update_option('home','http://818.555.342.341/~newurl');
Adding this code to wp-config file.
define('WP_HOME','http://818.555.342.341/~newurl'); define('WP_SITEURL','http://818.555.342.341/~newurl');
When Switching to the New Domain
- Change the DNS/Nameservers to the new server.
- Check .htaccess and remove any caching code and any references to the temp domain.
- Check wp-config.php file and make sure the new domain is set and not the temp domain.
- Run a search and replace script to replace the old domain with the new one (for advanced users only)
- If having any problems, check in phpmyadmin to make sure the domain was switched inside the options table for wp.
Great tip… guided me in the proper direction. Thanks.
On Siteground you can find the temp url in the admin panel under “My Accounts” >> Account IP >> Right hand side “Access Site By IP” Click it and a new window with the temp url pops up.
Spelling mistake – “Build your new website and point the nameservers when your all done.”
Should be “Build your new website and point the nameservers when YOU’RE all done.”
Your is used for, say, your bag, your phone, this is your website. You’re is an abbreviation of you are.
Oh, my mistake. Thanks for catching that 🙂
Critic?
Hi Heather, this was really useful thanks! I had done everything except the .htaccess mod until I found your article and was tearing my hair out – once I did that everything worked!
I just need to remember to switch it back when the site goes live… 😉
I love you! This is exactly the tutorial I needed today. Thank you thank you thank you.
This is the only page on the WHOLE internet (and I read every single one) that actually fixed my problem where the WordPress home page worked, but every other page gave me: “The requested URL /index.php was not found on this server.”
The .htaccess modification did the trick! I feel like a total coding ninja right because of you 🙂
That’s wonderful Joe! Thanks 🙂