WordPress Redirect Loop

I’m currently in the process of migrating WordPress to a new server, and I made a somewhat silly mistake.

Basically, after setting up my virtualhost, wordpress, etc I ran into a redirect loop, where the site would always redirect from the actual name of my blog (“example.com”) to a signup page, and the signup page would then redirect to itself.

I was at my wits’ end, so I enabled debugging by adding:

define('WP_DEBUG_LOG', true);

and changing this line to “true”:

define('WP_DEBUG', true);

This creates a logfile called “debug.log” in your wp-content subdirectory.And lo and behold, it turns out I had forgotten to actually import my MySQL data.

18-Nov-2018 10:07:46 UTC] WordPress database error Table 'wordpress.wp_blogs' doesn't exist for query SELECT blog_id FROM wp_blogs WHERE domain IN ( 'blog.example.net' ) AND path IN ( '/wp-signup.php/', '/' ) ORDER BY CHAR_LENGTH(path) DESC LIMIT 1 made by require('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), require('wp-includes/ms-settings.php'), ms_load_current_site_and_network, get_site_by_path, get_sites, WP_Site_Query->query, WP_Site_Query->get_sites, WP_Site_Query->;get_site_ids

I know how it happened – I redid my migration from scratch and took a break of a few days just before that step – and it’s unlikely someone else might run into this exact problem.

However, the steps to debug it are still valuable – had I done that in the first place, I might have saved myself quite a bit of time.