Problems with WordPress multisite directories/url structures and admin access after migration

I'm trying to migrate a multisite WP installation to a new server. The network consists of a simple parent site that redirects users to one of four subsites based on their location. E.g. if a user from the UK visits the site, they're redirected to the site.com/uk subsite.

Before the migration, each subsite's theme plugin resources (images, css, js etc.) were available from the subsite's url, e.g. site.com/uk/wp-content/themes/uk-theme/images/image.svg. After migrating the site to the new server, the resources are no longer available from the subsite domains, but are available from the parent site's domain, e.g. site.com/wp-content/themes/uk-theme/images/image.svg. This is causing all the stylesheets, images js for each subsite to 404.

The other issue is that, although the main multisite network admin is accessible (site.com/wp-admin/), the subsite's admin panels aren't accessible, and going to site.com/uk/wp-admin, for example, produces an ERR_TOO_MANY_REDIRECTS error.

I feel like the two issues might be linked somehow but I'm not sure. Does anyone know why this might be happening and how I might be able to fix it?

Topic directory urls multisite server database Wordpress

Category Web


I don't know how the migration was executed, but here are some things that have caught me out in the past.

Files: Check the .htaccess and wp-config.php files. htaccess for a multisite should look something like this:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

And wp-config.php should have extra lines defining constants:

define( 'WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
etc...

If they are already there, you could try reverting them to regular (non-multisite) versions and going through the process of converting to a multisite manually. That way you could be sure the files are correct as WP will generate the files and DB stuff automatically.

Database: The options table for each multisite install should contain correct site_url and home. The wp_blogs table (probably not wp_ in your case) needs to contain path for each install.

Hope some of that helps. Will add more if I anything comes to mind!

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.