Build Your Own Business Website header image

Create a Development Copy of your Live WordPress Site on a Subdomain

Difficulty Level -

Filed Under Topics - ,

Listed Under Lesson Subjects -

Applies to -

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Part 1 – Copy the Existing Site

In this session, we demonstrate how to manually create a development copy of your Live WordPress Site on a subdomain that can be used for testing your customization before editing your actual website.

First, we create the subdomain that we will be using as the development site. Then we copy all files in the live site folder to the development site folder using File Manager. Next we need to edit the database information on wp-config so we create a new database and then input the database information in the wp-config file.

Video Transcript

What we’re going to do now is, “How to Create a Development Copy of a Live WordPress Site on a Subdomain” and of course this is that development site I was talking about. You’re going to use it for testing customization before you edit the actual website.

Testing Customization Before Editing

This has a number of steps and this is the manual method so we’re not going to use BackupBuddy to do this. I already have plenty of videos on how to do this with BackupBuddy but I don’t have a lot of videos on how to manually clone a site. Now, I do have some on how to manually clone your site to a local server but this is actually easier.

I had a conversation with Cathy here earlier today because she was going to make a local development copy of her site and she’s going to install BitNami and all the rest of the stuff to make that work. In fact, developing on an actual subdomain on the same web host that your site exists on is actually a much simpler way to do it. It’s a lot simpler not to develop on a local copy of your site, it’s much easier to develop on a remote copy of your site. I think the only reason I would recommend that you develop on a local copy is if you’re doing a really intensive programming work. Then you know why you do it and you know what you’re doing, so you don’t need my advice on that.

Generally, it’s just a lot simpler and the main reason why it’s simpler is that, in order for you to do it locally, that is in order for you to do it on your own computer. What you have to do is create a server on your computer and your server settings are never going to be the same as the server settings of your host. So you always run the risk of having something that you’re developing not turn out exactly what you expected it to because the host server settings are different than your own and you also have all the trouble shooting and problem solving associated with setting up a server on your own computer. And so it’s much simpler now to do it that way, we’re gonna do it this way.

Step One – Create a Subdomain

Step one is to create a subdomain. Now, if you are Cathy and you are with a GoDaddy, then you need to ask them to do it. I maybe don’t need to ask them to do it, maybe you can do it yourself. But if you’re on BlueHost or some other host that has a control panel or cPanel as a control panel, you can do this yourself very quickly. And this is what we’re going to do right now. So, I’m gonna come down first to the domain manager. I have a whole bunch of addon domains in this hosting account. My primary domain is byobwebsite.com but I have a whole bunch of addon domains and perks domains or unassigned domains here that I’ve purchased.

We are going to create a subdomain of thesisecommerce.com, that is a site that I use for developing a class about a store. What I’m doing with it is I’m getting ready to just kind of transform it into a place where I talk about different eCommerce platforms for Thesis. This is a live site, it doesn’t look very good because I’ve sort of torn it apart. We’re going to add a domain to that and what I’m going to do then is come back over to cPanel and instead of looking at the Domain Manager, we’re going to look at subdomains. Under subdomains, I’m just going to create a subdomain called “development”. I’m going to make it a subdomain of this addon domain which was thesisecommerce.com. So here’s thesisecommerce.com, so I’m going to create a subdomain called development, thesisecommerce.com.

Now, you can see that in public HTML, it’s going to be inside of a directory called “development”. What’s going to happen here is that when I create the subdomain it will create this folder, we hit “create”. That’s actually going to create a subdomain right now, so development.thesisecommerce.com has been created. If we go over to cPanel and we go down to our File Manager, we can see that it is created this folder “development”. If we open it up, it’s just got their sort of typical stuff. In fact, we could come over here and go there and you’ll see what BlueHost’s stuff looks like now. This is a BlueHost’s kind of begining page looks like for development.thesisecommerce.com that’s caused by these files here. So that’s step one, create a subdomain, check the results in File Manager.

Step Two – Copy Your Site Files

Step two is to copy your site files. That starts off again in site manager. Let’s go up a level and the one that we are changing is thesisecommerce, so I’m going to select all. Then I’m going to choose “copy”. All I really need to do here is come down and instead of thesisecommerce, I’m going to go to “development”, that’s the name of the directory I want all these files copied to. It’s a bunch of files so it’s going to take a minute, I believe. It usually gets something weird, the thing asks me whether or not you want to delete something, so I think we’re just going to wait for that. Oh, didn’t get it. Let’s go over and take a look and see what there is then. Go up a level, go down to “development” and there it is, it’s all been copied over here now. That’s step two. Copy your site’s files. It’s pretty easy doing it this way.

Step Three – Copy Your Site Database

Step three is copy your site’s database. So we’re going to open up phpMyAdmin, select that database and we’re going to export the database. Now, we have one little challenge here which is, I don’t actually remember the name of that database. So, I’m going to come down to my wp-config file and I’m going to edit it. I’m not going to really edit it, I’m just going to read it but you can see that the database name is byobwebs_wrd14 so that’s the database I want to get access to.

At my cPanel, I’m going to scroll down to a phpMyAdmin and go to that byobwebs.. It’s going to be phpMyAdmin and then we are looking for wrd14. Here it is. We’re going to go to export and we’ll just go ahead and select a quick export, it’s going to be “export in the SQL format”, and we’ll just say, go. What this export’s going to do is essentially exporting all the database tables into a file and it synced to my computer so you can see down here in the lower corner that my computer has just downloaded byobwebs_wrd14.sql. Now I have the database sitting on my computer that I’ve just exported. That’s step three, export your database.

Step Four – Create a New Database

Step 4 is to create a new database and we do that again. Actually this is depend upon hosts so I don’t actually think I can create a new database inside of this. They don’t actually let me create a new database here so I have to go back over to cPanel. They don’t recreate database in Bluehost, what I have to do is use this MySQL Databases Wizard. So I’ll just go ahead and open that up and call this one “development, so byobwebs, development.

Next step is I’m going to do a username. I’m going to use exactly the same name. Oh, actually I can’t. I can only use that mini characters so I’m going to say “develop”, and I’m just going to let the password generator, generate the password for me. I guess I better copy this one. Use that password, let’s just make sure we paste that password here for the moment. Remember that the username is “develop”, so I’m going to create the user. I got to give it “all privileges”. That’s what we’re going to do right now, you need to make sure that, the user has access to all the privileges. We’ll say next step and now it says, “User byobwebs_develop” was added to database “byobwebs_development”. We’ve now created a database, created a user and created a database password. So that was step four.

Step 5 – Fix the Development wp-config File

Step five is we need to fix the development version of wp-config because it still has the old database name, the old username and the old password. We do that back inside of cPanel and remember here, we open up wp_config and let’s just make sure it’s the wp-config that’s in our “development” directory. So we come down here and double click on “development” and come down to wp-config. I’m actually just going to use a code editor this time. What we’re going to do is define database name. It’s not webs, it’s now development and the username was “develop”, and the password is whatever that was. Here it is, there’s the password.

These are the things that we have to change inside of the wp-config file because we need this installation of WordPress to communicate properly with the database. We’re just going to go ahead and hit “Save Changes”. Okay, that’s done. We can go ahead and close the text editor. That was step five.

4 Comments… add one
4 comments… add one
  • Jason April 9, 2013, 8:51 am

    Try logging into the wp-admin on the subdomain and you’ll discover it won’t let you: WP will force you to login to the primary domain. This dev scenario doesn’t work.

    • Rick Anderson April 9, 2013, 2:32 pm

      Jason, I do this all the time. It works just fine.

  • tammitron June 21, 2013, 5:53 am

    Good day, I also followed all the above steps… all works fine, but when I attempt logging onto the wp-admin, I am redirected to the main website’s dashboard. 🙁

    • Rick Anderson June 21, 2013, 3:43 pm

      Tammitron – that happens when the options table doesn’t get changed to reflect the new URL. You must make sure that the options table gets edited correctly.

Leave a Comment