How to build a new WordPress site while the old site is live

Time is always pressured, and the ability to break a task such as building a brand new website into bite-sized chunks is essential. This is where staging sites come in, or temporary domains, or reference domains, or sub-directories, or sub-domains…. You’re potentially starting to get the picture here that this is about as clear as mud  in most cases. Above all else, it comes with an overall feel that someone with more coding knowledge should really be dealing with it!

I’ve looked at a number of guides out there with a focus on “Ease of Implementation” and found a few good step by step instructions.

Option 1 – Install WordPress on a Subdirectory of your existing domain

Ok, what the hell does that mean?

A subdirectory looks like a page or post URL i.e. mydomain.com/subdirectoryname/

The benefit of using this method is that once you’ve built your new website for mydomain.com you can quickly move your site from mydomain.com/subdirectoryname/ by copying and pasting a couple of files and making a minor edit to one of them.

The files to copy are;

  • index.php
  • .htaccess

You’ll be copying these files from the subdirectory folder under your domain directory folder.

You’ll then paste these files into the domain directory folder (which should be located in you public_html folder. For example;

Public_HTML > mydomaindirectory > mydomainsubdirectory

This is especially the case where you have a hosting account with multiple domains hosted. In this case you’ll have multiple folders at the ‘mydomaindirectory’ folder level situated under the Public_HTML folder.

Editing the index.php file

Once you’ve got these files copied and located in the right folder, you’ll need to edit you index.php file.

Find this line in the index.php file;

require(‘./wp-blog-header.php’)

and replace this line with the following;

require(‘./subdirectory/wp-blog-header.php’)

but instead of using the word ‘subdirectory’ swap this out with the name of the subdirectory you created. i.e. in my example about the subdirectory I creasted was mydomain.com/subdirectoryname/ therefore I would modify the line in the index.php file to say;

require(‘./subdirectoryname/wp-blog-header.php’)

Save the file and exit.

Final few steps to transitioning to your new WordPress Site

You need to edit your URL settings in WordPress, so go to ‘Settings > General’ and change the current URL for the ‘WordPress Address’ and the ‘Site Address’.

You’ll be changing the subdirectory URL to the main domain URL. So for example, what you’ll see in the General Settings tab is your subdirectory URL which would look like this;

https://mydomain.com/subdirectoryname/

You’re going to change this to;

https://mydomain.com/

And that is pretty much it for using the subdirectory approach.

These instructions were adapted from an Article written on the WPMU DEV Blog, you can see the full instructions on how to build a new WordPress Site whilst your existing site is live.

Option 2 – Install WordPress on a Subdomain or Reference Domain

The instructions for this one are really very well laid out in a series of short videos from PootlePress.com

You can check out the article and all of the videos by visiting their video tutorial article ‘The easiest way to build a new WordPress site while the old site is live’

Option 3 – Plugins and a bunch of other very tech heavy solutions

Although “tech heavy” might be an over-statement, there doesn’t seem to be any significant drawbacks in taking the above 2 approaches to creating a staging site. Therefore, why make things more difficult than they may need to be?

There are of course drawbacks to each approach, and the potential for error (particularly with non-coders) is significant, therefore the focus on “ease” is well justified.

There are other options though, including plugins and of course, outsourcing the setup of the staging site and it’s movement onto your main domain.

Here’s an extensive guide from the Quicksprout Blog which also discusses a few further options for moving a site from one domain to another, including some more “tech heavy” manual options.