What does the 401 error code mean? - UdayanWeb - Number 1 Web hosting company

Article sections

    What is a 401 error?

     

    A 401 Unauthorized error is an HTTP status code indicating that the server received an unauthenticated request. 401 error code responses are most often generated because of invalid credentials for a particular page or destination on your website. This status is typically sent with a WWW-authenticate header that contains information on how to authorize properly.

    In human terms, this basically means that your client isn’t able to authenticate itself with the server and, as such, cannot view the resource. For example, a specific page might require a valid username and password.

    The 401 error code, like other error codes in the 400-range, means there’s a problem on the client-side – AKA the problem lies on your web browser’s side (or another client), rather than the website you’re trying to visit.

    How to fix the 401 error on WordPress

    1. First Check the URL for errors

    It is possible that a 401 error occurs because you have typed the URL incorrectly or the login URL has been changed. Alternatively, you may have clicked on an outdated link in your web browser. In cases where a page no longer exists, the server might show a 401 code. Check the URL for spelling mistakes. You can also use a search engine to find the correct URL of the webpage you are trying to access.

    2. Clear Your  browser cache and cookies

    Your browser’s cache helps improve your overall surfing experience by decreasing the loading time of websites. To do this, browsers store local copies of the content you visit most frequently. Your browser’s cache can sometimes overlap with the live version of your application, resulting in a 404 error code.

    To fix this error, just clear the browser’s cache.

    Similar to the cache, there are HTTP cookies which are basically tiny pieces of stored data. Invalid and/or corrupted cookies can cause an authentication error. Clear the cookies and try to open the page again.

    3. Deactivate All  your WordPress plugins

    Because WordPress plugins can alter how your site functions, they’re a typical cause of the 401 error code on WordPress.

    In the case of WordPress security plugins, sometimes the plugin intends to do this. For example, some plugins will lock down your login page if the plugin thinks you’re under attack, which can trigger the 401 error code when you try to open your login page. Or the firewall in a plugin like Wordfence might cause the issue.

    In this case, once you figure out the issue by deactivating the plugin, you can reach out to the plugin’s support to understand the issue.

    Other times, it could be an unintended compatibility issue.

    To figure out which plugin is causing the 401 error, try deactivating all of the plugins at your site and reactivating them one-by-one. Or, if the error only appeared after you installed a new plugin, try deactivating that plugin first.

    4. Remove Your server-level password protections

    If you’re using htaccess/htpasswd to protect parts of your WordPress site with an extra username/password, try deactivating this extra password protection.

    Many web hosts also give you a tool to control such passwords from cPanel. Look for a tool named something like:

    Password protect directories
    Directory privacy

    5. Flush your DNS

    In rare cases, DNS errors can cause the server to show a 401-error code on your browser. To fix this, you need to flush your DNS. Although this is a fairly unusual cause, it is quite simple to repair.

    For Windows users:

    Log in to your computer as an administrator
    Open a “search” window
    Type in CMD.exe in the search field to open Command Prompt
    Enter this little code in the CMD interface: “ipconfig/flushdns”
    For macOS users:

    Open the Command Terminal
    Enter this code in the terminal interface: “sudo killall -HUP mDNSResponder”

     

    in WordPress