WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] TOO_MANY_REDIRECTS Error when using basic authentication (12 posts)

  1. tk5
    Member
    Posted 10 months ago #

    I set up multisite and add the following on .htaccess to use basic authentication on log-in page (wp-login.php) and getting error "310 (net::ERR_TOO_MANY_REDIRECTS)" and I can not access to the log-in page.

    It works on the local set up using XAMPP but not work on the server.

    What am I doing wrong?

    <files wp-login.php>
    AuthName "Login Password Required"
    AuthType Basic
    AuthUserFile /home/xxxx/.htpasswd
    require valid-user
    </files>
    
    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]

    Multisite setup on the server and local (XAMPP)
    (using sub-directory and installed on the subdomain)
    test.xxxx.com (root site)
    test.xxxx.com/en/
    text.xxxx.com/jp/

    I would appreciate it if anyone could suggest about this issue.

    Thank you.

  2. ak75963
    Member
    Posted 10 months ago #

    which version of xammp r u using?

  3. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    Have you spoken to your hosts about this?

  4. tk5
    Member
    Posted 9 months ago #

    Thank you, ak75963.
    xammp version is 1.8.1

    Thank you, esmi.
    Yes, but their response is as follow;
    Sorry about the issues you're having with your website. Unfortunately providing support for .htaccess modifications is outside the type of support we offer. You would have to consult with a developer about any coding issues.

  5. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    Personally, with a response like that, I'd be looking at moving hosts! What happens if you just use:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . index.php [L]
  6. tk5
    Member
    Posted 9 months ago #

    Thank you esmi.

    If I just use above code, I get the same error (TOO_MANY_REDIRECTS).

    If I use below code, the authentication box pop ups but after put the user name and password, I get the same error.

    <files wp-login.php>
    AuthName "Login Password Required"
    AuthType Basic
    AuthUserFile /home/xxxx/.htpasswd
    require valid-user
    </files>
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . index.php [L]

    When I use the same basic authentication on the single site it works fine on the same server.

  7. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    I'm by no means a multiuser expert but I suspect that you will have problems trying to password protect wp-login.php in this way across a network. But I could be wrong...

    Did you send a copy of the original .htaccess file to your hosts when asking them about this issue? Seems to me that this is a server configuration issue so they should have had something to say about it.

  8. tk5
    Member
    Posted 9 months ago #

    Thank you esmi!

    I will contact my hosts again.
    Thank you for your advise!
    I appreciate it.

  9. I'm by no means a multiuser expert but I suspect that you will have problems trying to password protect wp-login.php in this way across a network. But I could be wrong...

    Multisite ;)

    This should work on Multisite, to be honest, I've never bothered with it. Take it out to veryify that WP is working without it, though. It may not be the htpasswd.

  10. tk5
    Member
    Posted 9 months ago #

    Thank you Ipstenu.

    WP is working without it, I have created the subdirecoty on the same server and installed the backup and found out it works fine (I can log-in with basic authentication on xxxx.com/test/wp-login.php).

    I'm wondering if this is related with hosting's subdomain configurations and I submitted the ticket to my hosts.

  11. tk5
    Member
    Posted 9 months ago #

    I got the solution from hosts and that is just add the following two lines to .htaccess.

    ErrorDocument 401 "Denied"
    ErrorDocument 403 "Denied"

    Thank you.

  12. tk5
    Member
    Posted 9 months ago #

    I close this.

Reply

You must log in to post.

About this Topic