Migrating WordPress

Shuffling WordPress around (moving hosts, or moving to the root) is something I do quite a bit. We try to keep the root as clean as possible, so we’ll usually install WordPress in a subfolder, then follow these instructions to make sure visitors can get to our site (by moving the index.php to the root).

This is a consolidated version of the instructions, but saves us time rather than trying to find it in our bookmarks or our  library of PDF’s.

Moving WordPress To Root

If moving from domain.com/wordpress to domain.com

domain.com = root

domain.com/wordpress = subdirectory

 

Instructions

  1. Access wordpress via FTP
  2. Copy – do not move – index.php and htacces file from subdirectory to the root
  3. Edit index.php in root
    1. require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );
    2. add the /wordpress so it looks like this:
      1. require( dirname( __FILE__ ) . ‘/wordpress/wp-blog-header.php’ );
  4. Change SITE URL via wordpress dashboard > settings > SITE URL
    1. change to root (domain.com)
    2. DO NOT change WordPress URL

Ref: Giving WordPress Its Own Directory

Migrating WordPress

  • Upload All Files via FTP
  • Create mySQL database in new hosting (mySQL)
    • Use Wizard
  • Export & Backup existing database (phpMyAdmin)
  • Import sql into new hosting (phpMyAdmin)
  • Edit wp-config file
    • name and username
    • password
    • change hostname (if none provided, try localhost)
  • In mySQL wp_options change
    • WP_HOME
    • WP_SITEURL