Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordPress Migration - All you need to Know - WordCamp Delhi 2017

WordPress Migration - All you need to Know - WordCamp Delhi 2017

The Talk was presented at WordCamp Delhi 2017 on 19th August 2017. Following are the pointers covered in the talk.

Hassle-Free WordPress Migration
– Educating about basic default database structure of WordPress and DNS records, WP-CLI in brief.
– Problems that are faced while migrating WordPress to another server and how does one resolve them effectively.
– Migrating staging site or local environment to Production site
– How one can change the domain of their WordPress installation after migration
– What are the different ways/tools available for migrating WordPress?
- How one can effectively utilize WP-CLI to migrate your WordPress site?

Vineet Talwar

August 19, 2017
Tweet

More Decks by Vineet Talwar

Other Decks in Programming

Transcript

  1. Default Database Structure • wp_posts • wp_postmeta • wp_comments •

    wp_commentmeta • wp_terms • wp_term_taxonomy • wp_term_relationships • wp_users • wp_usermeta • wp_options • wp_links
  2. • Love Black Screen ? • Easy Installation • Simple

    Commands • Easy Maintenance of WordPress • Example: To check WordPress core version- wp core version WP-CLI
  3. Ways/ Tools For Migration 1. Cloning Plugins ◦ WP Clone

    by WP-Academy ◦ Duplicator 2. Default Plugin ◦ WordPress Importer and Exporter ◦ Widgets Importer and Exporter 3. WP-CLI
  4. Moving to Another Server (1/5) Level 1: Cpanel Hosting (

    Old School ) 1. Zip Home directory and Download 2. Open phpMyAdmin 3. Export Database 4. Login to new Cpanel Hosting 5. Upload Zip File 6. Import Database 7. Set DNS Records
  5. Moving to Another Server (2/5) Level 2 - Beginner: Use

    Cloning Plugins 1. Install WordPress on new domain 2. Install cloning plugins on both installations 3. Export clone file from one installation using plugin 4. Import to new installation 5. Save Permalinks
  6. Moving to Another Server (3/5) Level 3 – Advanced: Server

    Environment (1/2) 1. Zip wp-content folder zip -r wp-content.zip wp-content 2. Save wp-content.zip in document root. 3. SSH to new server. 4. Download the zip using wget on new server wget http://olddomain.tld/wp-content.zip 5. Unzip wp-content zip file unzip wp-content.zip
  7. Moving to Another Server (4/5) Level 3 – Advanced: Server

    Environment (2/3) 1. Export XML file: wp export 2. Download WordPress on new server: wp core download 3. Install core on new server: wp core config --prompt wp core install --prompt 4. Install Plugins and themes wp plugin install plugin-name --activate wp theme install theme-name --activate 5. WordPress Importer wp plugin install wordpress-importer --activate 6. Import XML File: wp import --prompt
  8. Moving to Another Server (5/5) Level 3 – Advanced: Server

    Environment (3/3) 1. Export XML file: wp db export db.sql 2. Download WordPress on new server: wp core download 3. Create wp-config.php wp core config --prompt 4. Install the required plugins and themes wp plugin install plugin-name --activate wp theme install theme-name --activate 5. Import Database wp db import --prompt
  9. Changing Domain Name Constants in wp-config.php define( 'WP_HOME', 'https://newdomain.tld’ );

    define( 'WP_SITEURL', 'http://newdomain.tld’ ); Change the domain name in Backend. Go to WordPress Backend. Then, change the domain name in Settings > General Hack the database: In table wp_options change record home and siteurl Database Query: UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.tld, 'http://newdomain.tld') WHERE option_name = 'home' OR option_name = 'siteurl'; WP-CLI: wp option update home https://newdomain.tld wp option update siteurl https://newdomain.tld
  10. Search-Replace Plugins Better Search-Replace, Search- Replace Database Query: UPDATE wp_posts

    SET guid = replace(guid, ‘https://olddomain.tld’ ,'https://newdomain.tld’); UPDATE wp_posts SET post_content = replace(post_content, 'https://olddomain.tld’, 'https://newdomain.tld’); UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://olddomain.tld','https://newdomain .tld'); WP-CLI: wp search-replace https://olddomain.tld https://newdomain.tld
  11. Migration Common Problems and Solutions Problem Solution Mixed Content /

    Mixed URL Search-Replace 404 on Page Permalinks and htaccess rules 404 for all links for https site Redirect all links to https via htaccess rewrite Images Not Loading Possibly Missing uploads folder HTTP Error 500 Use WP_DEBUG to debug Missing Widgets Use widget-importer-exporter plugin Where is Landing Page Settings > Reading > Front Page New Domain not working DNS Propagation 404 on search-console Set 301 redirect to new domain