401 Error

401 error: Common causes and how to fix it

9 MINS
Angelo Pocong

Key takeaways: 

  • Error 401 means a user can’t access a webpage because they lack valid authentication credentials.
  • HTTP errors like 401, 403, and 404 are temporary and fixable.
  • Regularly clearing browsing site data helps improve the browsing experience.

When surfing the Internet, encountering a 401 Unauthorized error page can be frustrating, especially when the website contains the information you need. For website owners, this may leave a negative impression on your potential visitors.

So, what’s causing this issue to recur, and what can you do to fix it? Let’s get an overview of the 401 error code and its common causes, including basic tips on how to fix it.

What is the 401 Error code?

HTTP error 401 means a user doesn’t have permission to access a target resource, usually a password-protected website. The response includes a WWW-Authenticate header, which tells the browser what authentication method is required. If the user lacks valid authentication credentials, entry is denied.

As a result, a variation of 401 error messages may appear on screen depending on the browser the visitor is using. Google Chrome and Microsoft Edge users will likely see the “HTTP Error 401” error message below the phrase “If the problem continues, contact the site owner.”

401 error variations

Other variations of 401 error include:

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

Types of 401 Error

There are different types of 401 errors, each with a specific cause.

  • 401.1 – failed login attempt.
  • 401.2 – the server configuration caused the failed login attempt.
  • 401.3 – the ACL (Access Control List) caused the failed login attempt.
  • 401.501 – the client generated too many requests and reached the maximum request limit.
  • 401.502 – a client of the same IP reaches the dynamic IP Restriction Concurrent request rate limit by sending multiple requests to a single web server.
  • 401.503 – the client’s IP address is in the server’s deny list.
  • 401.504 – the client’s hostname is in the server’s deny list.
domain privacy

What causes a 401 error?

 A 401 error is quite common and should not be something a website user should worry too much about as long as they input valid credentials on their browser’s address bar. However, it’s also good to know the common causes of this error to prevent or resolve them in the future.

While the HTTP 401 error usually means that the authentication process failed due to incorrect credentials, other issues can also trigger it. They include:

  1. Incorrect URL. An incorrect URL is a common cause for a 401 unauthorized error to appear on your screen, especially if the page is restricted.
  2. Outdated browser cache or cookies. Saved login data expires and prevents your browser’s request from going through successfully.
  3. Plugin misconfiguration. Plugin errors or incompatibility causes your firewall to mistakenly identify your login attempt for malicious activity.
  4. Server protected URLs. Many hosting providers intentionally set password protection on their servers to prevent general access to their website’s restricted resources. This results in a 401 error page popping up on your end.
  5. Restricted .htaccess file. When a website owner forgets to remove their previously set password protection, the Apache directives from their site’s .htaccess file will automatically be added, causing the 401 error code to display on the screen.

How to fix the 401 error code

Now that you know the causes of the 401 error, it’s time to fix it. Below are a few examples of how you can resolve this issue.

1. Correct any URL errors

Manually typing long URLs increases the chances of making errors. Website owners may update, move, or delete their web pages at any time. If you encounter the HTTP 401 server error or get redirected to another website, double-check for any wrong URLs from your browser’s address bar and correct them.

2. Clear your browser cache and cookies

Your browser stores site data and cookies to improve your online experience by limiting page loading time. However, when they become outdated, they cause unwanted interruptions to your authentication process.

By cleaning invalid data from your device’s internal storage, you help your device run optimally and prevent the 401 error message from displaying on your screen.

To clean your browsing data, follow these steps.

For Google Chrome

1. At the top right-hand corner, click the Kebab Menu or three vertical dots.

          2. Scroll down and click Settings.

          3. On the left-hand side, click Privacy and Settings.

          4. On the Privacy and Security tab, click Delete Browsing Data.

          5. Uncheck Browsing History to keep track of previous websites you’ve visited.

          6. At the bottom right-hand corner of the pop-up, click Delete Data.

          For Microsoft Edge

          1. At the top right-hand corner, click on the Meatballs Menu or the three horizontal dots.

          2. Far down, click Settings.

          3. On the left-hand side, click Privacy, Search, and Services.

          4. Scroll down and look for the Delete Browsing Data tab.

          5. On the Delete browsing data tab, Click Choose What to Clear.

          6. Uncheck Browsing History and Download History.

          7. Click Clear Now.

          For Mozilla Firefox users, clearing browsing data may look slightly different compared to Chrome and Edge. It’s done by clicking the library icon at the top-right corner of your browser. Click Clear Recent History, then choose a time range. If you choose the Everything option, all your browsing and downloading history, active logins, search history, cookies, and cache will be removed from your device’s internal storage.

          3. Flush the DNS cache from your device

          If the same error occurs after clearing your browsing data, the next thing to do is clear your DNS resolver cache. Although this step is not as common, you can do this by opening your command prompt (Windows) or Terminal app (Mac).

          For Windows users

          1. On your Windows Search Bar, type cmd.
          2. Click Command Prompt.
          3. On the command prompt window, type ipconfig/flushdns.
          4. Press Enter.

          For Mac users 

          On the Spotlight search, Type Terminal and press Enter to open the Terminal app. 

          1. If you’re using a macOS Big Sur or later versions of macOS, type the following command in the Terminal window: sudo killall -HUP mDNSResponder.  
          2. Press Enter
          3. Type in your password. Note that you won’t see the characters on your screen. 
          4. Press Enter.

          Older macOS requires different commands. Try the following:

          MacOS Version Command 
          Catalina sudo killall -HUP mDNSResponder 
          Mojave sudo killall -HUP mDNSResponder 
          High Sierra sudo killall -HUP mDNSResponder 
          Sierra sudo killall -HUP mDNSResponder 
          El Capitan sudo killall -HUP mDNSResponder 
          Mavericks sudo killall -HUP mDNSResponder 
          Mountain Lion sudo killall -HUP mDNSResponder 
          Lion sudo killall -HUP mDNSResponder 
          Yosemite sudo discoveryutil udnsflushcaches 

          4. Contact the site owner

          If none of the solutions work, try contacting the website owner. Tell them about the 401 error and the steps you’ve taken to resolve it. This way, they can provide additional solutions specific to their website, such as resetting your account credentials or granting the necessary permissions.

          How can a website owner fix the 401 error?

          While the 401 error code is usually on the client’s side, sometimes errors can stem from a server error. How can you fix it? Here’s how:

          Important: Please proceed with caution, especially when it comes to settings that affect your website security and up-time.

          1. Deactivate your WordPress plugins

          From a developer’s perspective, if your visitors are still having trouble accessing your website, try deactivating your site’s security plugins. To do this, follow these steps:

          1. Open your WordPress dashboard.
          2. On the right-hand side, click the Plugins option.
          3. Click Installed Plugins.
          4. From the dropdown menu, look for the security plugin you wish to deactivate.
          5. Click Deactivate.

                  See if the 401 is still there. Once fixed, your visitors may now have server access to explore your website.

                  2. Review the security settings of your website

                  Another way to resolve your site’s 401 error issue and approve a client request to access your web page is to disable password protection. You can do this by following these steps:

                  1. Through Site Tools, open your hosting panel.
                  2. Open the Security section.
                  3. Select the Protected URLs option.
                  4. Click Manage Protected URLs.
                  5. Delete any unnecessary protection settings under the Actions column.

                  3. Check your site’s .htaccess file

                  You can also disable any password protection from there. Here’s how:

                  1. Go to your File Manager (FTP).
                  2. Locate the .htaccess file and open it.
                  3. At the bottom, delete the code where it says password protected area.

                      Note: Modifying the .htaccess file can cause serious problems if not done correctly. If a user is not comfortable with server-side file editing, please refer to the next option.

                      4. Contact your hosting provider

                      If you’ve tried everything and the 401 error persists, contact your hosting provider. Tell them about the issue and the necessary steps you’ve already taken. This way, they can check for further server-side authentication issues, misconfigurations, and security rules that you might have overlooked.

                      Best practices to avoid 401 errors

                      Overall, the best way to prevent the 401 Unauthorized error from recurring is to ensure that you’re inputting valid credentials, which include the correct username, user ID, and URL.

                      At the same time, regularly clearing your browsing site data, cache data, and cookies beforehand is also helpful in improving your browsing experience. It reduces problems such as slow page loading speed and formatting issues.

                      Error 401, error 403, and error 404: What’s the difference?

                      Before we wrap this up, it’s important to address common misconceptions about HTTP status codes, especially those in the 400s. 401, 403, and 404 errors are often confused because they relate to access issues. But they have distinct meanings.

                      • The 401 error means that the WWW-authenticate header detects invalid or missing credentials, which indicates an unauthorized or expired session from your end.
                      • The 403 error, also known as the “403 Forbidden” error code, is a response status code indicating the server understands the request but still denies the client access. This type of error is the same as the 401 error. However, any re-authentication credentials won’t change the web page access due to the website owner’s restrictions.
                      • The 404 error or “Not Found” error indicates a broken or dead link. This means that the website is either temporarily or permanently unavailable.

                      This error may be caused by moved or deleted pages, a mistyped URL, caching issues, DNS settings problems, or missing assets from the website.

                      Error CodeMeaningCause
                      401UnauthorizedNo valid credentials
                      403ForbiddenAccess is denied despite authentication
                      404Not FoundPage doesn’t exist

                              Understanding error messages improves user experience

                              Errors 401, 403, and 404 are temporary and fixable. However, when they occur too often, they can be frustrating for users and may lead to lost traffic for website owners. Understanding these errors and how to troubleshoot them helps create a smoother browsing experience, benefiting visitors and site owners.

                              Troubleshoot with peace of mind, knowing your site is backed up with Web.com’s CodeGuard.

                              • Angelo Pocong

                                Angelo is a content writer at Web.com. He loves helping people with digestible and valuable content. He loves learning new things and is passionate about different art forms.

                              Leave a Comment

                              Trending Topics