How to Move WordPress From Local Server to Live Site

How to Move WordPress From Local Server to Live Site

Most of the people like to develop the site locally in their computer using XAMPP/WAMP/WAMP server because it increase the speed of development and also they don’t have to upload updated file every time. But they face a major issue while uploading the finished site into the live server. So here is a Step By Step Guide to Migrating Your WordPress Website to a New Web Host.

Step 1: Upload full WordPress site in live server

ftp upload
First of all you have to upload the full site in to the live or hosting server through FTP Client. Don’t know how to upload file using FTP Client Read this.

Step 2: Export Local WordPress Database

export from phpmyadmin
After uploading all the files you have to export the full database from your local phpmyadmin.

Step 3: Change Site URL and Broken Links

find and replace
Now open this SQL file in any text editor, say for example NetBeans. Now open “find and replace” (or press Ctrl+H) type http://localhost/wp-theme in Find What and write you domain name say for example “http://yourdomainname.com” in Replace with; and then click Replace All and Save that SQL file. Now you database file is ready.

Step 4: Upload the Database.

Now upload the new database in the database of your hosting provider. Don’t know how to do this Read this.

Step 5: update wp-config.php

Open the wp-config.php in any text editor. And update following code

  • DB_NAME with your new database name
  • DB_USER with your new database username which all the privileges.
  • DB_PASSWORD with your new secure password you created for your MySQL user.
  • DB_HOST with you new host name, in most of the cases it remains localhost.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wp_theme');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Step 6: update .htaccess file

Now you have to remove some of the unwanted code from the .htaccess file.

# BEGIN WordPress
RewriteEngine On
RewriteBase /wp-theme/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp-theme/index.php [L]
# END WordPress

Delete /yousitename as in my case it is /wp-theme and the new file would look like this

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Hopefully by now your live site is up and running. Checkout your site to make sure every thing is working as expected. For troubleshooting and questions feel free to leave us a comment below and I will try to help out as soon as possible.

Share this Post:

About Raunak Gupta

I'm an expert Laravel, WooCommerce, WordPress theme and plugin developer, over the time I have developed several sites and applications. I like to help the upcoming developer, So I share my experience through this blog.  

Related Posts:

One thought on “How to Move WordPress From Local Server to Live Site

Leave a Comment

Your email address will not be published. Required fields are marked *


*