database - Problems with WordPress multisite directoriesurl structures and admin access after migration

admin2025-01-07  6

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/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/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/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/wp-admin/), the subsite's admin panels aren't accessible, and going to site/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?

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?

Share Improve this question edited Jun 18, 2020 at 14:02 Ash asked Jun 18, 2020 at 13:42 AshAsh 214 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

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!

just a comment to the people outthere. I was having the same issue, .htaccess correct, php correct, apache logs correct, wp-config correct. The issue was in my hosting service related to the dns zone and type of records. The thing was that the subdomains (each multisite) was registered as a CNAME of the primary doaming. Example: primary.com Type: A DATA:x.x.x.x

And the sites were: sub.primary.com Type: CNAME DATA:primary.com

that did not work, I had to create a SUBDOMAIN in the hosting webinterface and dns zone, redirect that subdomain (sub.primary.com) to the same IP as primary.com (x.x.x.x).

¿and if I create a hostA record directly? That did not work for me. I supouse that is about the hosting provider technology.

Cheers!

Nacho

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736256486a364.html

最新回复(0)