Support » Plugin: Lockdown WP Admin » 404 File Not Found Error

  • nateluis429wo

    (@nateluis429wo)


    Other people have reported this problem, and I thought I’d do a writeup of what I found.

    First, the decision of whether or not to serve the login page is made in this file:
    plugins\lockdown-wp-admin\src\Lockdown\Application.wp
    Line 182. It returns False IF it doesn’t think that the url you entered matches the url for the login page that you entered into the options page.

    That’s the 1st place you should start troubleshooting if you page “404 Error” or “Page Not Found”.

    SPECIFICALLY, for me, the problem was caused by lines 164, 165. It’s testing the url in a case-sensitive way. So, for example, if your login page is
    https://www.myTestSite.com/MyLoginPage,
    but the user enters
    https://www.mytestsite.com/myloginpage,

    The code looks like this:

    $request_url = str_replace( $blog_url, '', $current_url );
    $request_url = str_replace( 'index.php/', '', $request_url );

    You’re not going to get the login page. This is a problem, especially now that many browsers will take whatever you enter into your browser and automatically convert it to lowercase for you.

    In the example above, myTestSite.com is set in WordPress:
    Settings->General

    You should set that url to all lower case (https://www.mytestsite.com). That way, when your browser auto-converts your address bar to lowercase, it’ll match.

    The other solution is to fix those two lines of code (add the letter ‘i’ in str_ireplace). That’ll make the login urls NOT case sensitive.

    $request_url = str_ireplace( $blog_url, '', $current_url );
    $request_url = str_ireplace( 'index.php/', '', $request_url );
  • The topic ‘404 File Not Found Error’ is closed to new replies.