Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator t-p

    (@t-p)

    Thread Starter nortok00

    (@nortok00)

    Thanks for the speedy reply but I had already checked/tried these things. As mentioned I believe this is “normal” behaviour given other sites I have worked on have also done this. Also… the link you provided is a different situation. I believe the issue mentioned there was that the homepage was redirecting to the login page. In my situation it’s a shortened login url redirecting to the actual login page.

    Thanks again.

    Thread Starter nortok00

    (@nortok00)

    I wanted to provide a little more context to my question.

    In my htacess there are these line:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    I understand that the first one says “if there is no file”, the second says “if there is no directory” then do the third and “got to index.php which loads the site. So in my case (as in other sites I have managed) mysite.com/login doesn’t exist as a file or folder so it’s redirecting index.php but what I’m trying to understand is how /login is getting identified with /wp-login.php. I could understand if my htacess was doing some pattern matching (ex: if /login doesn’t exist look for something with login in the filename and go to it) which would explain loading wp-login.php but that’s not the case here.

    I want to re-iterate that this is not a problem. I’m fine with it doing this I just want to know where this 302 redirect is coming from in WP. Is this a wp-json thing?

    Thanks.

    Thread Starter nortok00

    (@nortok00)

    I found it. The directives are in /wp-includes/canonical.php. There are a few shorthand URLs baked into WP (since version 3.4.0) so /login goes to /wp-login.php and /admin goes to /wp-admin.

    If anyone is having issues with weird redirects that aren’t attributed to plugins, the database, htaccess and all the other usual suspects then it’s possible someone edited this at some point to customize it. Or if someone doesn’t has these shorthand URLs then they might have been removed (security reasons?) or possibly there’s an issue with this file.

    The response code I’m getting is a 302 and that’s not specified in this file so I’m not sure if that’s a WP default response code or whether it’s the server but that wasn’t of concern to me.

    Hopefully this helps someone else in case anyone was having issues or just wanted to know. 🙂

    Thread Starter nortok00

    (@nortok00)

    And the default response code (if none is specified) is 302 for apache so the mystery is solved. 🙂

    Moderator t-p

    (@t-p)

    Glad its sorted 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘/login does 302 redirect to /wp-login.php’ is closed to new replies.