1.2 Launch a WordPress Site From Development to Live
In this lesson, I’ll walk you through the process of migrating your site from development to your live server. I’ll demonstrate a complete deployment process for a WordPress site, including moving the database, plugins, themes, and files.
1.Launch a WordPress Site From Development to Live2 lessons, 08:31
1.2 Launch a WordPress Site From Development to Live
[MUSIC] Hello and welcome to this tuts+ coffee break course on migrating your WordPress site from your development site to your live site. In this course, I'm gonna show you how to take a development site that you've created on your local machine and migrate it to your live hosting server. Now migrating WordPress is a little bit more complicated than a static HTML site, because instead of just copying the files across, you also need to install WordPress on your live server. And you need to copy your database. So here's my local site. You can see that it's local because I've got it on localhost here. Now it's really careful when you're doing this to keep good track of when you're working locally, and when you're working remotely. And you might want to use different windows in your browser, or even different browsers. So here's my dashboard for that site. I don't need to use the dashboard to do the migrate. Instead, I'll do it using phpMyAdmin, which is a tool provided by my hosting provider, and using a code editor, in my case Coda. So what I've done first, is I've created a blank WordPress installation with my hosting provider and you can see the URL of this up here. Now you can either do that by installing Word Press manually using the famous five minute install. Or alternatively if your hosting provider gives you a tool such as soft oculus or fantastico. You could use that for a one click installation of WordPress. One word of warning though if you do do that. Make sure when you've done it that your version of WordPress is up to date and also that it has an installed any plugins that you don't want. Because some hosting providers will do that. So here's my blank installation of WordPress. What I want to do is copy my local development site, i.e. this site, onto this. So let's do that. So, if you've got MAMP running for your local development, you can go to this URL and access the MAMP screen. And then I go into phpMyAdmin. So let's have a look at what databases we've got. The database I want to use is this one here, called WordPress. Now if you've only got one local site. You'll only have one database. So you don't need to select one. And then to make a copy of my database, I click on Export. And then I just click Go. And that has made a copy of my database. Now I then need to copy all that into an SQL file. So I'll select it all, copy, and then I'm gonna open Coda. You can select whatever text editor you want. I've created a new file in Coda and then I'll paste everything in. So, that is the contents of my database. I'm gonna save that and call it database.sql. So now I've got that saved. The next thing to do is to replace all of the references to your local site's URL with the live site's URL on your site. So let's find one. I'll do a find, and I'll look for localhost. Let's find the first one. So here you say we've got http/localhost/WordPress. Now my live site will have a different URL. So I need to make sure that that is replaced throughout the database. So I copy that, apparent to find box and then I'm gonna go back to my new live site, which is here. And I'll get the base URL for it. I don't want the wp admin bit. I'll copy that. Go back into Coda and in the replace failed up here, I'll copy that. So as you can see, I'm replacing http://localhost/WordPress with http:rachelmccollin.co.uk/tutsplus-live. Now my hosting provider has added a www here. Ideally, when you set up your site, I would actually take that out because it's not really needed anymore. So I want to replace all instances of the old url. So I simply click on the all button here. And that's made 124 replacements. Now depending on how much content you've added to your site. There might be a lot more than that. Sometimes thousands. And again I'll save it and I'll close that file down. Right. So now back in my browser. I'm in the Control Panel screens that my hosting provider has given me. Now yours might look a bit different from mine, depending on your hosting provider. But you should find that you've got access to something called phpMyAdmin. Which is just the same as the phpMyAdmin, we just used locally. And that will open this screen. I want to find the right database. And the one I'm using here that I've created for my new site is called tutsp. So there it is, and your site will already have a database set up. So what you need to do is replace all of the tables in this new database with the tables from the database that you've already made a copy of. So the first thing I'm gonna do is drop all of these tables, which means delete them. So I select them all, I click on drop and then when it checks if I really want to do it, I click Yes. So now there's no database so my new site and it won't work. So the next step is to click on Import. So I've clicked the Import button and now what I need to do is choose the file that I'm going to import. So here's my database SQL. I'll select that and then click Go. And phpMyAdmin tells me that that import has been successfully completed. So now I have the database tables for my development site present in my live site. But there's still one more step to take because my site won't work just yet. And what I need to do is copy across any plugins or themes that I've got activated on my site. Now it's important that you do this before you go back and try and open your site again. Because if you haven't imported any plugins or themes, they will be deactivated when you open your site, so your settings won't be exactly the same as they were in your development site. So I'm gonna use Coda to copy the plugins and themes across from my local to my live site. And here's Coda opened up With my live site on the server over here on the right. And my local site, which is in my htdocs folder, which mom creates, over on the left. And in wp-content, on each of them, you can say that there are a number of folders. My local site has got more folders because that's got more content. So let's start with the uploads. Over here, there's nothing. So what I'm gonna do is drag and drop all of my uploads into here and you can see the folders have all appeared. I'll then do the same with themes. Now I've just got one theme here that I want to drag across, so I'll do that And then finally the plugins and let's compare on both sides. I've got Akismet, hello and index on both so I don't need to copy that but I've got Google Analytics and Super Cache installed. So I'll copy those over to plugins. So now all of the content in my wp-content directory that I need is moved across. I'm not gonna worry about the cache here, because a new cache will be created by WP Super Cache when I launch my live site. So I've now created all three elements of my live site, the WordPress installation, the database, and the files. And now if you go back to your live site, as mine is here. You will see that it's got all of your new content. So here's all my posts from my development site. And if I go to the live site, here it is looking exactly the same. That's my localhost. It's running the same theme, it's got the same content, it's got the same plugins and the databases migrated across. So that's how you migrate your local development website to your live hosting setup. Thanks for watching.