Migrating WordPress

Moved this WP (3.0.3) blog from staging in LAN to shared hosting on WebFaction (WF).

  1. Scrub “transients” from database — some 400KB of junk, temporary data, to not copy/backup.
    $ mysql --user=me --password=secret foo_db
    mysql> delete from wp_options where option_name like "%_transient_%";
    Query OK, 33 rows affected (0.01 sec)
  2. Fix(?) site’s URLs — change to new location:
    mysql> update wp_options set option_value="http://decodecode.net/elitist" where option_name in ("home","siteurl");
    Query OK, 2 rows affected (0.02 sec)
    Rows matched: 2 Changed: 2 Warnings: 0
  3. Dump DB:
    $ mysqldump --user=me --password=secret foo_db > foo_db.`date --iso-8601=seconds`.sql

    Dump is 42KB (down from 372KB with transients).

  4. Install WP on WF as application foo_wp. WF generates wp-config.php:
    define('DB_NAME', 'user_foo_wp');
    define('DB_USER', 'user_foo_wp');
    define('DB_PASSWORD', 'x2mK7xYd8');
  5. Add application to site decodecode at route “/elitist”.
  6. Copy theme over (108KiB), after checking there are no symlinks or temporary files in it. (I did not touch core; only files changed: .htaccess, wp-config.php, and the theme.)
  7. WF did not put an .htaccess in the fresh WP installation? Without this default WP .htaccess I get cyclic redirections errors.
    # Apache configuration for WordPress.
    RewriteEngine On
    RewriteBase /elitist/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /elitist/index.php [L]
  8. No nonces generated in wp-config.php!? (I easily add them in Kate: tools → insert file → https://api.wordpress.org/secret-key/1.1/salt/. KIOSlaves FTW! ;o)
  9. Copy the SQL dump over (8KB gzipped) to ~/tmp/. Ungzipped it (so file name is last in command line, and tab-completion works).
    $ gunzip "foo_db.2010-12-23T20:59:37+02:00.sql.gz"
  10. Restore database:
    $ mysql --user=user_foo_wp --password="x2mK7xYd8" user_foo_wp < "foo_db.2010-12-23T20:59:37+02:00.sql"
  11. Browse to http://decodecode.net/elitist/ to verify everything works.
  12. Log in with credentials used in staging, not WF’s generated account.

There.



Comments are closed.