Web Design & UX

401 Error: What It Is and How to Fix It

  • There are no suggestions because the search field is empty.

By Laia Cardona, on 28 February 2023

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.

* Are you planning your social media strategy? Keep track of the most  important holidays and cultural eventswith our FREE 2023 Community Manager  Calendar!

401 Error_ What It Is and How to Fix It

What Does a 401 Error Mean?

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:

  • HTTP Error 401
  • 401 Authorization Required
  • HTTP 401 Error - Unauthorized
  • 401 Unauthorized
  • Access Denied

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:

  • 401.1: login error
  • 401.2: login error because of server configuration
  • 401.3: failed authorization by ACL (Access Control List)
  • 401.4: filter authorization error
  • 401.5: CBI or ISAPI application authorization error

These specifications usually appear when the web server is running with Microsoft's IIS (Internet Information Service).

What Causes a 401 Error?

There are many reasons you may be encountering a 401 error, including the following reasons:

1. Incorrectly Configured Plugin

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.

2. Wrong URL

When a URL address is misspelled or outdated, the 401 error may appear.

3. Restricted Site .htaccess File

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.

4. Cache Problems

As a user, your browser cache may be out of date or corrupted, preventing you from properly accessing the website you want.

5. Protected URL

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.

Ways to Fix a 401 Error

1. Check Your Plugins and Deactivate Them if Needed

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.

2. Review the URL

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.

3. Clear Your Computer's Cookies and Cache

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.

4. Clear the DNS

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".

5. Analyze the .htaccess File

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.

6. Log Back in or Reload the Page

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.

Difference Between a 401 Error and 403 Error

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.

How to Prevent a 401 Error From Occurring

Clearing cache and cookies as well as DNS records on a frequent basis is the best way to prevent the 401 error from occurring.

New Call-to-action

Laia Cardona