Search code examples
wordpresshttp-redirectmultisite

WordPress Multisite Redirect Issue


I have a multisite install using subfolders for which the landing site works just fine as does the first subsite.

Having added 2 subsequent subsites, they both end in a redirect loop with no entry in the Apache error log.

  • multisite.domain.com (loads)
  • multisite.domain.com/site1 (loads)
  • multisite.domain.com/site2 (redirect loop)
  • multisite.domain.com/site3 (redirect loop)

I have tested using the TwentyTwentyTwo theme and no plugins enabled, but the issue remains.

wp-config and .htaccess are setup as per the network requirements.

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'multisite.domain.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

In adition to the above, a suggested fix was to add the folllowing to wp-config, which does not fix things in this instance:

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
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]

The main site is itself on a subdomain (multisite.domain.com) not sure if this would be an issue as one subsite works just fine?

The issue is apparent on localhost and on the development server, so seems to be a specific site/Apache configuration issue, but odd one subsite would work, while the others do not.

Has anyone encountered this oddity before?


Solution

  • Bizarrely, the issue has rectified itself.