• Resolved Razz

    (@razz)


    For the past two months, I’ve been developing a site in a folder in my public_html/ . Currently, I have a subdomain pointing to this folder for development purposes. Later, this dev folder will be made the primary domain’s root folder.

    The site was set up to use custom permalinks %post-name% with and had no problems whatsoever.

    A week ago, the site suddenly decided to give me problems when trying to access https://www.mysite.com/wp-admin/ . It errors out with “Too Many Redirects” in all browsers.

    However, https://www.mysite.com/wp-admin/index.php allows me to access the Dashboard and manage my site the way I always have.

    I found that if I change the permalinks setting back to the default, I can access /wp-admin/ with no problems.

    To test this issue, I installed a fresh copy of WordPress on an empty database and could replicate the problem. I switched the permalink structure to anything but “Default”, and I get the error when going to /wp-admin/. I then open /wp-admin/index.php and can access the Dashboard and change the permalink setting back to “Default” and the redirect issue goes away.

    Besides trying to access /wp-admin/ , the site works exactly as it should with no errors.

    I can access /wp-login.php with no problems at all times, but upon logging in, it directs me to /wp-admin/ which puts me right back at square one.

    Other issues/resolutions similar to this were due to plugins and random custom code and all that, but for my testing I’m using default, start-from-scratch everything.

    I tried modifying my .htaccess as the following with no success:

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

    And I’ve cleared my cookies, private browser, added the following to my wp-config.php file:

    define('WP_HOME','https://example.com');
    define('WP_SITEURL','https://example.com');

    TL;DR: /wp-admin/ causes a redirect loop ONLY when I set permalinks to anything but “Default”.

    Any help is greatly appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter Razz

    (@razz)

    Of course, as soon as I put out a call for help do I figure out the problem.

    I can’t account for the site suddenly having the redirect issue, but I at least found a fix.

    Because the site is being developed under a subdomain, there are specific rewrite rules required for the .htaccess file. Help was found here:

    https://stackoverflow.com/questions/21947648/default-wordpress-htaccess-causing-redirect-loop

    which pointed me to the official WordPress htaccess examples page. There, I found an .htaccess example specifically for WordPress installed under a subdomain, specifically this:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress

    When replacing my main .htaccess file with this, my site immediately responded to trying to access /wp-admin/ with great success. Permalinks have been changed back to %post-name% instead of the Default, and everything works as it once did.

    I hope my plight will be useful to anyone else who has this specific problem.

Viewing 1 replies (of 1 total)
  • The topic ‘Non-Default Permalinks causing /wp-admin/ Redirect Loop’ is closed to new replies.