In the last two chapters, I talked about Installing WordPress Locally and Building Custom WordPress Theme. This chapter will cover exporting your local WordPress to a web host. Assume you are done with the local WordPress development, it is time to learn how to export and import WordPress. Then you can keep the local version for backup purpose and future development (ie. testing new themes, plugins, and upgrades).
1. Export Local Database
Login to your local phpMyAdmin, select the database from the dropdown. Click on the Export tab:
- Under the Export field, make sure all tables are selected
- Under the Structure field, tick "Add DROP TABLE / DROP VIEW"
- Tick "Save as File"
- Then click Go and it will prompt you to download a SQL file

2. Find & Replace All Local URLs
Open the database SQL file with a text editor. Find and replace all local URLs with your domain URL (eg. replace all "http://localhost:8888/mysite" with "http://www.yourdomain.com").

3. Import The Database
Login to your server cPanel, go to MySQL Databases, create a new database and assign a user. Now go to phpMyAdmin, select the database (the one that was just created) from the dropdown, click on the Import tab, browse the SQL file and click Go.

4. Upload WordPress
Upload the entire WordPress folder to your server.
5. Change The wp-config.php Setting
On your server, open the wp-config.php file. Change the database details to reflect your server settings.

6. Done
Go to your website and everything should work perfect.
Um, how about copying your theme over and then using the wordpress export/import feature?
@Aaron – Yes, you can use the export/import feature built-in WordPress, but then you have to re-do the settings and re-activate the plugins.
mmm…interisting enough, especially in replacing SQL script text with text editor like notepad, thank’s alot
recently i moved my page from the dev server to the final server, it’s really easy. good tutorial series nick.
Thanks again Nick!
I just get a blank white screen when I go to the new blog again after going through all the steps above. I’m stressing out that I’m never going to get this to work for me… :(
If you’re using mod_rewrite permalinks and moving from localhost/my-site to my-site.com you’ll also need to modify the .htaccess file in WP root.
@Masey You just need to reactivate your theme on the design page.
Thank you !
http://sferlazzorossella.wordpress.com
strange info about local url replacing 8(
I always think that wordpress is good enough do not store absolute URLs
Thank for the tutorial again
I would have thought another benefit of doing this is it will copy over things like category ID’s which will save you having to search your theme for where you’ve excluded cat’s etc.
Handy post btw, thanks very much!
What about using the real domain as local domain so you don’t have to do any editing while migrating?
Go to:
C:\Windows\System32\drivers\etcand open the file “
hosts” with notepad.Then add the domain for each site your develop:
127.0.0.1 http://www.example1.com #For browser access
127.0.0.1 http://www.anothersite.net
127.0.0.1 http://www.yetanothersite.org
Install xampp (I don’t explain that):
And then go to the folder:
B:\xampp\apache\conf\extraThen open the file “
httpd-vhosts.conf” with notepad.Under the document you see this:
DocumentRoot /xampp/htdocs
ServerName default
Then add the following (note that you use the right foldername for document root and server alias to get it right:
#Note that example1 is the folder name which can differ for
#the used file name
DocumentRoot /xampp/htdocs/example1
ServerName http://www.selectedimpact.nl
ServerAlias localhost/example1/
DocumentRoot /xampp/htdocs/anothersite
ServerName http://www.anothersite.net
ServerAlias localhost/anothersite/
DocumentRoot /xampp/htdocs/yetanothersite
ServerName http://www.yetanothersite.org
ServerAlias localhost/yetanothersite/
[Note that you disable the domain name in the “hosts” file when you want to see the “real” website.
Have fun with it!
oops. in my previous comment wordpress swallowed parts of the code so its not usable in the httpd-vhosts.conf file.
So you need to put everything between the usual brackets like is used in html and in this example I replace it with [ and ]:
[VirtualHost *:80]
DocumentRoot /xampp/htdocs/example1
ServerName http://www.example1.com
ServerAlias localhost/example1/
[/VirtualHost]
etc. for the other sites you want to add.
Good tutorial. Definitely want to mess around with things on the local drive before go live.
Thanks so much… very excited to finally get my own wordpress theme up
Simple clean tutorial, nicely done!
HI Nick – If I wanted to integrate a wordpress blog into my website – I can still follow this tutorial so I can just write the blog directly in my site once I follow these steps correct? I just want the WordPress directly in my site – like: http://www.mysite.com/blog – is this ok? Let me know! Thanks again. Great tutorial!
Awesome Tutorial! I think I’m going to have to change my website to a wordpress site!
@Michelle Lana – Yes, just install WordPress in a new folder (ie. “blog”)