If you get a 401 Unauthorized error when attempting to visit a website, you should do something about it. Whether you’re the site’s owner or a visitor, the frustration of getting an HTTP error 401 error can be unbearable. The issue can be only temporary in many cases, luckily. Plus, before you get annoyed or even enraged, you should know that there are several solutions to the issue. Since over 40% of indexed websites use WordPress, this problem usually crops up with this Content Management System (CMS), making our job easier. But before you learn what the fix could be, we’ll let you know everything about the Unauthorized 401 error.
What is 401 Unauthorized Error?
When you see a “401 Authorization required” error, it means that the page you were trying to reach is password-protected, and you haven’t entered the right credentials. It’s one of the most common HTTP status codes, along with 404 Not Found and 500 Internal Server Error. The 401 HTTP code may also occur if there are some issues with the website’s htaccess file or web server permissions. With that said, here is a collection of possible solutions to fix the 401 Unauthorized error.
1. Check Your Site Login Credentials
This is the first thing you should do when seeing a code 401 HTTP error. Simply check if you’ve entered the right login details. If you’re unsure, reset your password. If the issue persists, consider reaching out to Customer Support, if it exists.
2. Clear Browser Cache and Cookies
If you still can’t fix the response code 401 error, try clearing your browser cookies and cache. Over time, these files can get corrupt and cause problems while loading a website. To clear your browser cache, follow the steps below:
1. Delete Chrome Cache
Clearing cache in Chrome works this way:
- Do one of the following:
- Press Ctrl + Shift + Delete shortcut keys together to open the “Clear Browsing Data” window.
- Click on the three vertical dots in the top-right corner of Chrome and select More tools > Clear browsing data from the dropdown menu.
- In the “Clear Browsing Data” window that appears next, check all the boxes and click on the Clear data button.
2. Remove Cache from Firefox
The procedure is similar:
- You have two options:
- Press the Ctrl + Shift + Delete keys at once.
- Click on the three horizontal lines in the top-right corner of Firefox and select History > Clear Recent History from the dropdown menu.
- In the “Clear All History” window, set the Time range to “Clear to Everything.” Now, check all the boxes and click on the Clear Now button.
3. Clearing Edge Cache
Proceed to click the three horizontal dots in the top-right corner of Microsoft Edge and:
- Select Settings, then choose what to clear from the dropdown menu.
- Head to “Clear browsing data pop-up,” check all the boxes, and click on the Clear button.
If you are using another browser, search for how to clear cache and cookies on the Internet. Many are Chromium-based, meaning instructions will be nearly identical to the Chrome ones.
3. Fix 401 Unauthorized Error by Disabling Security Plugins or Firewalls
Now we are getting into the site owner guide. If you have any security plugins or firewalls installed on your WordPress site, try disabling them and see if the 401 authentication shows up. Once you find the culprit, contact the plugin author for further assistance.
4. Check Your .htaccess File
The next step is to check your WordPress site’s .htaccess file for any corrupt code. Connect to your WordPress site using an FTP client and:
- Navigate to the ~/wp-content/ directory.
- Now, right-click on the .htaccess file and select View/Edit.
- Once the file opens in a text editor, look for any suspicious code or text strings and delete them.
- Once you’re done, save the file and upload it to the server.
5. Change File Permissions to Fix 401 Unauthorized Error
If the problem persists, try changing your WordPress site’s file permissions. By default, the following are the recommended file permissions:
- For directories: 755
- For files: 644
You can change file permissions using an FTP client or cPanel. If you’re unsure how to do it, contact your web hosting provider for assistance.
6. Re-upload Some Core WordPress Files
If none of the above methods work, uploading your WordPress site’s core files again might do the trick. Connect to your WordPress site using an FTP client and navigate to the /wp-admin/ directory. Now, delete the following files:
- admin-ajax.php
- favicon.ico
- index.php
- license.txt
- readme.html
- robots.txt
- user-new.php
Once you’ve deleted these files, go back to the WordPress.org website and re-download a fresh copy of WordPress. Connect to your WordPress site using an FTP client and upload these newly downloaded files to your WordPress site’s /wp-admin/ directory.
7. Fix 401 Unauthorized Error by Reinstalling WordPress
If the concern persists, the last resort is to reinstall WordPress. This will delete all your existing content and settings, so make sure you take a backup of your site before proceeding. Once you’re ready, connect to your WordPress site using an FTP client and delete the following directories:
- /wp-admin/
- /wp-includes/
Now, go back to the WordPress.org website and download a fresh copy of WordPress. Once you have the ZIP file, extract it to your local computer. Connect to your WordPress site using an FTP client and upload these extracted files to your WordPress root directory.