0

I can log into http://localhost/wp/wp-admin/ fine, but logging into http://localhost/wp/wp-admin/network/ produces a network redirect loop (ERR_TOO_MANY_REDIRECTS). The site also loads just fine even when logged in.

How can I find out what is causing this? Wordpress 4.1 installed into subdirectory 'wp', then converted to multisite. There is only one site in the network so far.

update: This seems very relevant: https://wordpress.org/support/topic/network-site-redirect-loop-solution

  • A work-around is to remove the check to see if $current_blog->path matches $current_site->path.

I have tried clearing cookies and adding this code to wp-config:

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

My .htaccess (unmodified from WordPress multisite setup):

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).*) wp/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
RewriteRule . index.php [L]
2

Problem is here: in htaccess, instead of this:

RewriteBase /

you should have

RewriteBase /wp/

in wp-config.php, there should be:

define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);     //or true, depends on your chosen way
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/wp/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
0

In your wp-config.php, you should overwrite the given server-variables that cause the problem by adding this below your database-configuration in wp-config:

if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];
}
$_SERVER[ 'SERVER_ADDR' ] = DOMAIN_CURRENT_SITE;
$_SERVER[ 'REMOTE_ADDR' ] = DOMAIN_CURRENT_SITE;
$_SERVER[ 'HTTP_HOST' ]   = DOMAIN_CURRENT_SITE;

You need to set your multisite define('DOMAIN_CURRENT_SITE', 'www.betterplace.org'); above this, of course.

0

There's another possible cause of the loop when trying to access:

/wp-admin/network/

There's a redirect triggered at the bottom of:

/wp-admin/network/admin.php

This checks that the current blog and current website have the same path and domain values, if they don't then the redirect occurs.

Double check that the path specified in the wp_blogs table is the same as the path set on the current site.

These values can end up out of sync, especially when installing the applications inside a directory, eg. /blog/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.