admin管理员组

文章数量:1317123

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:

  • 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]

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/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]
Share Improve this question edited Jan 23, 2015 at 10:05 Leftium asked Jan 23, 2015 at 6:41 LeftiumLeftium 1411 gold badge2 silver badges8 bronze badges
Add a comment  | 

6 Answers 6

Reset to default 7

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 rather than just website define('DOMAIN_CURRENT_SITE', 'www.website');

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!

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);

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/

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'); above this, of course.

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!!

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

本文标签: Redirect loop (only for multisite network admin)