2

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]

6 Answers 6

6

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!

1
  • 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, 2020 at 12:39
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
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.

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/

1
  • 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, 2020 at 15:59
0
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', '**https://hotgossips.in**');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define( 'DISALLOW_FILE_EDIT', false );

Just put your full address in website url whether it's from www or https or https://www

After searching for a day i found my solution. This works for me.Hope it will work for you as well!!

-1

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

SSL TO FULL

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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