1

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);
| improve this answer | |
1

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.

| improve this answer | |
1

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/

| improve this answer | |
  • This solution worked for me as i had a multi-site install in a subdirectory. You have to synchronize the url in 1) DB > wp_blog 2) DB > wp_sites AND ALSO 3) wp_config.php > DOMAIN_CURRENT_SITE, PATH_CURRENT_SITE. – Larzan Jul 24 at 15:59
1

I also had the same redirect problem when trying to access wp-admin/network. Performing below changes fixed it.

1). In wp-config.php file, added www.website.com rather than just website.com define('DOMAIN_CURRENT_SITE', 'www.website.com');

2). use phpmyadmin --> wp_blogs table Add www. to the domain value

Basically, both site name and blog name have to be exactly the same.

Cheers!

| improve this answer | |
  • This did it, thanks! I've set up multiple multisites but apparently all of them have had a main domain without the www :D – mMoovs Jul 29 at 12:39
0

If you are using Cloudflare, from SSL/TLS tab of your Cloudflare account, select Full encryption. It will solve the issue.

SSL TO FULL

| improve this answer | |

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.