• matsumurakenpo

    (@matsumurakenpo)


    Hello Everyone

    I just created a network for multisite-purpose as described in the following link:

    https://wordpress.org/documentation/article/create-a-network/

    The idea is to have sub-sites for each language:

    http://okinawa-karate-moerfelden.de/de/wp-admin/
    http://okinawa-karate-moerfelden.de/en/wp-admin/

    But when trying to access the above dashboards, my request ends in an endless loop. This seems to be a common problem.

    I have read and tried many fixes regarding changing the content of the “.htaccess”-File as well as the “wp-config.php”-File but none of that worked.

    The following are the current contents of the file as suggested by the network-settings:

    .htaccess

    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    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]

    wp-config.php

    /* Multisite */
    define( 'WP_ALLOW_MULTISITE', true );
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    define( 'DOMAIN_CURRENT_SITE', 'okinawa-karate-moerfelden.de' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
Viewing 4 replies - 1 through 4 (of 4 total)
  • @matsumurakenpo

    Your configs do seem correct, but in .htaccess I’d still add two more lines, one on top and one at end, to check whether the mod_rewrite is even enabled or not

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    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]
    
    </IfModule>

    Though, it won’t help in your situation since it’s a redirect loop. Can you please confirm that only code written above is there in .htaccess and not anything else?

    In your wp-config.php file, can you please check if WP_SITEURL or WP_HOME constants are defined? If so, can you please remove or comment those lines?

    If the redirect loop still continues, it means some plugin or theme code might be causing the redirection, and if they are using wp_redirect function, we can temporarily stop those redirects by adding this code in active theme’s functions.php

    add_filter('wp_redirect', '__return_false');

    There are lot more things that can cause the issue, but if you can confirm these three things, we start going through other factors.

    Also, ensure to backup your site and database before making changes.

    Thread Starter matsumurakenpo

    (@matsumurakenpo)

    Hello and thanks for the fast reply.

    About mod_rewrite: That is the odd thing, I had to remove those lines, because 1.) That is how I understood the “Network Tutorial” mentioned above (“replacing other WordPress rules:”) and 2. The “My Sites” link was missing.

    Interestingly when I add the mod_rewrite: lines again, the “My Sites” link is still there. Maybe I am missing something about the execution of new lines added in .htaccess and wp-config.php. Is there something else to do besides uploading them via FileZilla?

    PS: Just to give more details about the error-message. I called it “redirect loop” because firefox-browser is loading endlessly without showing a message. In chromium-browser there is the error-message “ERR_TOO_MANY_REDIRECTS” shown.

    If you are talking about the .htaccess-File and its content. Do you mean more code in the BEGIN WordPress and END WordPress Section. Then the answer is no. The above code is everything. If you mean the file in total, then there is much more. If it helps, I can post the rest.

    In my wp-config.php there are no constants by the name WP_SITEURL or WP_HOME.

    About the plugins as possible root cause. I have read that several times and that is why I deactivated all of them. But it makes no difference at all.

    If I add your line "add_filter('wp_redirect', '__return_false');" it gets worse, I can’t even log in to the main-sites dashboard (the page is blank).

    Thread Starter matsumurakenpo

    (@matsumurakenpo)

    Found the cause after deleting everything except the Word-Press-Section in the .htaccess-File:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.php$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
    </IfModule>

    I think that is the default block in the Word-Press-Section, but it was located outside of the BEGIN WordPress and END WordPress comments.

    @matsumurakenpo

    Thanks for the follow up.

    It’s good to know it finally worked out for you 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multisite Access to Dashboard Ends in Loop’ is closed to new replies.