11

i installed a new WordPress 4.1 multisite

I can navegate Front and access to the main site dashboard

http://blog.urlcorrect.com/wp-admin/

I created a subsite and i can´t access to the subsite dashboard

http://blog.urlcorrect.com/br/wp-admin/

I have this error: Código de error: ERR_TOO_MANY_REDIRECTS

--

I can access to the Front

http://blog.urlcorrect.com/br/

but without styles, the css url is incorrect (Page not found):

http://blog.urlcorrect.com/br/wp-content/themes/twentyfifteen/style.css?ver=4.1

--

I have this values:

current blog domain: blog.urlcorrect.com
current site domain: blog.urlcorrect.com
current blog path: /
current site path: /

--

BBDD (wp_blogs table)

blog_id: 1
site_id: 1
domain: blog.urlcorrect.com
path: /
public: 1

blog_id: 2
site_id: 1
domain: blog.urlcorrect.com
path: /br/
public: 1

--

The htaccess:

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

--

The wp-config.php

/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'blog.urlcorrect.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

--

I can´t find the correct answer. What i´m doing wrong?

Thanks a lot

Pablo

6 Answers 6

18

(I don't take credit for the given solution) ;)

If you still have an issue with this try the solution with .htaccess.

Change given .htaccess template by WP Network installation:

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

To this:

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

Works with mine similar problem to yours.

Original solution was posted here link

5
  • Fixed my issue as well. Figured it was an htaccess issue but couldn't pin point it. In my case, my network install was the root of a domain, but not the root of the hosting; was installed to a subdirectory within my hosting.
    – Mike
    Commented Feb 9, 2017 at 21:24
  • Absolute genius! Thank you so much. However, I am kind of surprised to see why WP is not writing correct .htaccess when multisite was installed! Commented Nov 21, 2017 at 12:38
  • This does resolve the redirect issue but it breaks all links in the My Sites → Network admin menu.
    – Bob H
    Commented Jun 25, 2018 at 10:18
  • Thanks a lot! Works like a charm for Cloudflare Flexible SSL! Commented Oct 14, 2019 at 5:34
  • Still working on 2021 Commented Nov 3, 2021 at 20:26
2

If you are using Cloudflare than changing SSL mode from flexible to full like this:

enter image description here

This worked for me.

Source: https://wordpress.org/support/topic/wp-multisite-too-many-redirects-on-wp-admin/

1

Since you have a multi site WordPress you should remove the lines:

define('DOMAIN_CURRENT_SITE', 'blog.urlcorrect.com');

define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

from wp-config.php.

1

In my case I was using Nginx,

That means .htaccess won't work, because it's Apache.

If you're using Nginx, you might want to read the Nginx page of the WordPress Codex: https://codex.wordpress.org/Nginx

I'll paste the most importants parts here, in case the Codex go offline for whatever reason:

WordPress Multisite Subdirectory rules

# WordPress multisite subdirectory rules.
# Designed to be included in any server {} block.

map $uri $blogname{
    ~^(?P<blogpath>/[^/]+/)files/(.*)       $blogpath ;
}

map $blogname $blogid{
    default -999;

    #Ref: http://wordpress.org/extend/plugins/nginx-helper/
    #include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
}

server {
    server_name example.com ;

    root /var/www/example.com/htdocs;
    index index.php;

    location ~ ^(/[^/]+/)?files/(.+) {
        try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
        access_log off;     log_not_found off; expires max;
    }

    #avoid php readfile()
    location ^~ /blogs.dir {
        internal;
        alias /var/www/example.com/htdocs/wp-content/blogs.dir ;
        access_log off;     log_not_found off; expires max;
    }

    if (!-e $request_filename) {
        # Don't use `$uri` here, see https://github.com/yandex/gixy/issues/77
        rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
        rewrite ^(/[^/]+)?(/wp-.*) $2 last;
        rewrite ^(/[^/]+)?(/.*\.php) $2 last;
    }

    location / {
        try_files $uri $uri/ /index.php?$args ;
    }

    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass php;
    }

    #add some rules for static content expiry-headers here
}

WordPress Multisite subdomains rules

map $http_host $blogid {
    default       -999;

    #Ref: http://wordpress.org/extend/plugins/nginx-helper/
    #include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;

}

server {
    server_name example.com *.example.com ;

    root /var/www/example.com/htdocs;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args ;
    }

    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass php;
    }

    #WPMU Files
        location ~ ^/files/(.*)$ {
                try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
                access_log off; log_not_found off;      expires max;
        }

    #WPMU x-sendfile to avoid php readfile()
    location ^~ /blogs.dir {
        internal;
        alias /var/www/example.com/htdocs/wp-content/blogs.dir;
        access_log off;     log_not_found off;      expires max;
    }

    #add some rules for static content expiry-headers here
}

Note: WordPress Network installs no longer need the blogs.dir rules when creating a network, however may still be needed when migrating older installations.

0

What did the trick for me was to check the database.

Look for the table wp_options and change the rows with option_name siteurl and home from http://127.0.0.1/something to http://localhost/something

hope that helps!

0

In my case, I was also using Nginx...

I didn't follow the WordPress Codex docs, but CloudPanel's. My advice: don't include the "www." when you set up the server for WordPress, it's going to make your life easier. If you add the "www." and then you have to create a WordPress Network based on subdomains, you'll get the loop that's causing the "err_too_many_redirects" error.

If it's too late, what did the trick for me was:

  1. Change all the links of the database (via a plugin or, better, using SQL from phpMyadmin) from "www.example.com" to "example.com" (including the site url).
  2. Remove (or comment, as I've done in the example blow) this part from the server config file (it's right in the beginning). If you're using CloudPanel, you'll find it at Domains/your domain/Vhost:
#server {
#  listen 80;
#  listen [::]:80;
#  listen 443 ssl http2;
#  listen [::]:443 ssl http2;
#  {{ssl_certificate_key}}
#  {{ssl_certificate}}
#  server_name example.com;
#  return 301 https://www.example.com$request_uri;
#}

Needless to say, backup the database and anything you need before applying these changes.

Your Answer

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

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