Migrating your wordpress from localhost to server or from one domain to other domain

Migrating your wordpress from localhost to server

To move the wordpress site from one host to the other host or server, you can directly make the changes in the MySQL database itself.
Login to your phpmyadmin or MySQL command line and use the following commands on your wordpress database:

1. 

  UPDATE wp_options
     SET option_value = 'http://new_domain_name.com'
     WHERE option_name = 'home';

2.

 UPDATE wp_options
    SET option_value = 'http://new_domain_name.com'
    WHERE option_name = 'siteurl';

3.

UPDATE wp_posts
    SET post_content = REPLACE(post_content,
    'http://old_domain_name.com', 'http://new_domain_name.com');

4.

UPDATE wp_posts
    SET guid = REPLACE(guid,'http://old_domain_name.com', 
     'http://new_domain_name.com');

To make sure there are no broken links, reset your permalinks by following the below steps:

  1. Log in to your WordPress admin panel.
  2. Click Settings.
  3. From the Settings menu, click Permalinks.
  4. Note which kind of Permalink you currently use.(for custom permalink, copy the current permalink structure and save it in a notepad for later use)
  5. Select any Permalink setting other than the one you currently use, and then click Save Changes.
  6. Select your original Permalink setting(paste the above copied permalink structure in custom permalink), and then click Save Changes.

Start a Conversation

Your email address will not be published.