In this article we’ll help you understand what a 401 error is, why it occurs, and how you can solve it so that neither you nor your users will encounter it again.
The 401 error occurs when a user's browser does not allow them to access a page they are trying to visit without previously logging in with the corresponding data. This warning can appear in different ways depending on the browser used and other circumstances. You are encountering a 401 error if you see any of these messages:
The 401 error is a very common occurrence and they usuyally occur due to a problem with the browser, the internet provider, or the router. However, in most cases, it is the Internet itself that causes it.
Before encountering a 401 error, you may see more specific messages appear, such as:
These specifications usually appear when the web server is running with Microsoft's IIS (Internet Information Service).
There are many reasons you may be encountering a 401 error, including the following reasons:
There are security plugins in WordPress that offer different ways to restrict or limit entry to the website. These plugins can be misconfigured and mistakenly deny access to the public and even mistake normal activity as suspicious.
When a URL address is misspelled or outdated, the 401 error may appear.
One way to deny access to your website (or part of it) is through an .htaccess file. It is possible that, as the site owner, you password protected your website, and forgot to remove it. However, there are plugins that can also do this automatically, so you may want to check them out.
As a user, your browser cache may be out of date or corrupted, preventing you from properly accessing the website you want.
Some hosting providers offer the possibility to set up direct password protection with the server. Therefore, the request to log in may come from this protection.
There may be plugins on your website that are causing compatibility issues or that are configured to display a 401 error when they detect suspicious activity. The latter tend to be mostly security related.
We recommend you deactivate all your WordPress plugins and see which one is causing the problem. Don't worry because you will be able to reactivate the ones you want.
First, check that the address you entered is spelled correctly. If it is, the problem may be due to an outdated URL, but it is not redirecting you to the new one.
The process of clearing your computer's cache and cookies is very similar regardless of the browser you use. In Google Chrome, for example, go to the "Clear browsing data" section by pressing the "Command + Shift + Delete" keys at the same time for Mac or "Control + Shift + Delete" for Windows.
Clearing the DNS consists of deleting domain names from your server. This is a rare problem, but it is worth a try in case this is the cause. To do this, simply click the "Start" button and type "cmd" in the search bar. Pressing "Enter" will bring up the command prompt. Simply copy and paste this command "ipconfig/flushdns" and finish by pressing "Enter".
If your website is still is requesting login information, despite the fact that there is no password protection configured from the hosting panel, it may be due to directives in your .htaccess file. To check this, open your website folder from the file manager or FTP and inspect it.
You can try logging out of the website and logging back in or closing your browser and reopening it after a few seconds. It may seem simple, but sometimes the 401 error appears when a page has not loaded correctly.
While the 401 error denies access to a website due to a lack of permission, the 403 error appears when access to a section is prohibited without any option to enter, as these are directories or pages for internal use and are not available to external audiences. Therefore, while the first error is salvageable by putting into practice the tips we have given you above, the 403 error is not.
Clearing cache and cookies as well as DNS records on a frequent basis is the best way to prevent the 401 error from occurring.