Wordpress Multisite: Subsite wp-admin “err_too_many_redirects”

旧巷老猫 提交于 2020-06-24 11:53:29

问题


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


回答1:


(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




回答2:


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.




回答3:


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!




回答4:


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.



来源:https://stackoverflow.com/questions/28518723/wordpress-multisite-subsite-wp-admin-err-too-many-redirects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!