Wordpress Multisite: Subsite wp-admin “err_too_many_redirects”

前端 未结 5 2278
挽巷
挽巷 2021-02-14 15:22

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/
相关标签:
5条回答
  • 2021-02-14 15:46

    (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

    0 讨论(0)
  • 2021-02-14 15:49

    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 讨论(0)
  • 2021-02-14 15:51

    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.

    0 讨论(0)
  • 2021-02-14 15:59

    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 讨论(0)
  • 2021-02-14 16:01

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

    This worked for me.

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

    0 讨论(0)
提交回复
热议问题