Trying to access your wp dashboard or any other page, but cannot because of a 401 http error code?
If yes, calm your nerves. This error is fairly common, and as a WP user, chances are – you will see this error sooner or later.
It may also be that you are seeing this error in someone else’s site you are trying to visit. In which case, some of the steps covered below can help. But you may simply contact the website owner and let them know about it.
Whichever the case, it is important to understand the problem so you can know how to fix it.
In this article, we will explain:
What Is the 401 Error?
Put simply, the 401 error in WordPress is an http status code that indicates that the hosting server received an invalid request from the user. In other words, the server is saying that you have entered invalid authentication credentials and are not authorized to access the webpage.
The 401 error code message varies from Server to Server, but they all have the same meaning. The most common error messages are “Error 401” and “401 unauthorized error”. They are usually accompanied with the message “Access denied due to invalid credentials” or “Authorization required”.
What Causes the 401 Error?
Now that we understand what the 401 error is, we also need to know what causes it. Frankly, it can be something as simple as forgetting to enter your password when trying to access your account.
The http code also indicates that there is a client side error. This ‘client’ could be your browser, your router, your internet provider, and in many cases, the internet users themselves.
In addition the following issues may cause the 401 error which we will explain below:
– Incorrect URL: In this case, you may have entered the wrong URL. Doing this will give you the 401 unauthorized access error code.
– Invalid login credentials: If you put in the wrong login information, you would be denied access to certain pages on the website. If that’s the issue, entering the correct login credentials will quickly fix the 401 error code message.
– False login request: This rarely occurs, but when it does, it simply means that a WordPress website page that normally doesn’t require login will show a login page. When that happens, you will see the 401 status code indicating that you cannot access the page, which likely means that there’s an error with your site.
– WordPress Plugin issues: Your WordPress plugins may sometimes be glitchy or they may conflict with each other, thereby causing the 401 error code.
– Security / Firewall problems: We often use Firewall plugins in WordPress. While it is great to use one, it can also cause a 401 error on the site if hostile activities are detected. The plugin may block any unsecured connection to protect your site.
– DNS error / Failure: This particular issue is not common, but domain name system (DNS) collapse may trigger the 401 error code too.
Now that we have insight on the causes, the next important step is to know how to fix it. Just to let you know, most of these steps are simple, but some are a bit more advanced. Not to worry, we will take you through each and every one of them.
How to Fix the 401 Error in WordPress
Let us take you through the most common and effective fixes. We’ll start off with the easier ones as these will very often solve your issue.
Refresh the web page to easily fix 401 error
This is one of the simplest ways to fix the issue. The server hosting your site could be experiencing a temporary downtime at the moment. In this case, wait for some minutes and try reloading the page to get to the website.
Check URL for errors
401 issue could mean that there are errors in the URL, or the link is outdated and as such the page does not exist anymore. Check the URL character by character for any mistake and correct it. You can also make use of a search engine to find the correct link to the webpage you want to access.
Temporarily disable password protection
This is another easy fix for a 401 error code. If you have password protection enabled on your admin page, you have to disable it. This action is just temporary.
To disable password protection, head to your WordPress hosting control panel, such as cPanel.
When logged in, locate the ‘Directory privacy’ or ‘Password protected directories’ icon and click on it.
When it’s open, scroll down to ‘Public_html’ and click to open it.
Within this folder, locate the ‘wp-admin’ directory and click on the ‘Edit’ icon on its right.
When you do this, the control panel will show you your password protection settings.
Simply uncheck the box next to ‘Password protect this directory’ and click the save button.
After that, go back and scroll to the bottom of the page. You will need to delete your username as well.
With password protection disabled, you can now try to access your WordPress website. If you are successful, you can then create a new username and password for your page.
Clear Firewall cache
A cloud-based firewall service like Sucuri can fail when attempting to communicate with your WordPress site, thereby causing the 401 error.
To solve this, you have to clear cache in your firewall.
If you are using Sucuri for example, login to your Sucuri dashboard then visit the ‘Performance page’.
Switch to the ‘Clear cache’ tab and click on the ‘Clear cache’ button.
If you are using Cloudflare, here’s how to clear your cache.
First login to Cloudflare dashboard then head on to the ‘Caching’ section.
Head on to the ‘Purge Cache’ pane and select ‘Purge Everything’.
You will get a warning notification.
Still, click on ‘Purge Everything’.
Even if you do not use any of the firewalls we mentioned, the steps should also be easy for your firewall solution.
Clear your Browser cache and cookies
Your browser stores links (and other files) when you visit a site. In some cases, your browser may store faulty links which will disturb the login process and cause the 401 error. And you can resolve this issue by clearing your browser’s cache and cookies. This will allow the browser to download new files directly from the server.
Here’s how you do it in Google Chrome:
On the home page, click on the 3 dots in the top right to open the menu and then click on settings.
Once the Settings page is open, click on ‘Privacy and security’.
Next, click the ‘Clear browsing data’ option.
You’ll get a pop-up box. Here, select a time range, and then check the box next to ‘Cached images and files’ and ‘Cookies and other site data’. Lastly click on ‘Clear data’. This will clear the browser’s cache.
If you are using Mozilla Firefox, follow these steps:
On the home page, click on the 3 lines at the top right corner to open the menu and then click on ‘Options’.
Once the Options page is open, click on ‘Privacy and security’.
Scroll down to ‘Cookies and Site Data’ and click ‘Clear Data’.
Check the box next to ‘Cached Web Content’ and click on ‘Clear’.
Flush your DNS to solve 401 error
Like we said earlier, this issue is not often caused by DNS. But when it does happen, how do we fix it? By flushing the DNS.
The steps are also simple.
For a Windows user, you need to:
- Login to your system as an administrator
- Open a ‘search’ window
- Type in CMD.exe in the search field and click the Command Prompt icon to open Command prompt.
- In the CMD interface type the code: “ipconfig/flushdns”
But for a MacOS user, you will:
- Open the Command Terminal
- In the terminal interface, enter the code: “sudo killall –HUP mDNSResponder”
These will do the trick.
Deactivate your WordPress plugins
Plugins are very important for adding functionalities to your site.
Sometimes though, your plugins malfunction due to poor coding, or they may deliberately lock down your website when they detect a malicious attack. Any of these could trigger the http status code.
To fix this issue, you will have to deactivate all your WordPress plugins from the plugin page.
Here’s how you do it:
If you can access your WP dashboard, go to Plugins >> Installed Plugins.
All installed plugins will be listed there.
Check the box next to ‘Plugin’.
Next, click on ‘Bulk Actions’ and select ‘Deactivate’ from the drop-down menu. Now click ‘Apply’.
This will deactivate all your plugins one after the other. When this is complete, try accessing your site. If all goes well, then one of your plugins was the cause of your error.
Reactivate the plugins one after the other to determine the exact plugin causing the problem.
If you can’t access your WordPress admin area, then you will need FTP (File Transfer Protocol) to deactivate all WordPress plugins.
How to Deactivate WordPress via FTP
- If you don’t have an FTP client already (for example, Filezilla), you can download and install it.
- After installing FileZilla, open it and enter your credentials (host, username, password and port number). Contact your website host for some of these details. This will enable you to access files on your server. Learn more about accessing your site using FTP in this guide: How to use FTP.
- Locate the folder containing your WordPress files (usually public_html) and double click to open it.
- Next, look for your ‘wp-content’ folder, and double click to open it.
- Now locate your WordPress plugin folder (named ‘plugins’) and rename it to ‘plugins-deactivated’.
This will deactivate all WordPress plugins.
Once you’ve done this, try accessing your website again.
If it works out fine, you will need to go back to FTP client and rename your plugin’s folder to just plugins.
Now return to the admin area and activate each of the plugins one at a time until one triggers the 401 error. This will help you figure out the problematic plugin. Contact the plugin support to help fix it or find another option.
Switch to a default WordPress theme
In some cases, a WordPress theme’s inside function may cause a 401 error code. To fix this, you need to switch to a default WordPress theme. This action is also temporary. These themes are automatically installed with WordPress.
To start, go to Appearance >> Themes and deactivate your current theme. Next, activate a default WordPress theme such as Twenty Twenty.
If you don’t have any theme installed on your site then you need to install and activate one.
Once this is done and the error disappears, it shows the theme was responsible.
Send a report to the theme developer so they can help you with it or you can contact us to help you fix it.
Reset Your WordPress Password
Your WordPress hosting company can temporarily block access to your wp-admin login when your password has been entered unsuccessfully a number of times. This may present itself as a 401 error.
You can wait for some minutes or you can just change your password.
Click the “lost your password” link. You will get an email with a link from WordPress to help you change your password. Using the link, reset your password. Now try to login to your admin area to see if this fixes it.
Contact Your Website Hosting Provider
If, at this point, you still can’t access your site, it is time to contact your website host.
They may have blocked access to your WordPress website when they detected a malicious attack. When this happens, you will not be able to access your login page or even the entire site for a while.
Contact your web hosting provider for help with this. They will check your access and error logs and resolve the issue for you.
We are bound to face different types of errors on the internet, whether you use WordPress, or any other online platform.
The 401 error is one such issue. The good news is, there are simple steps to fix this error. In this guide, we have shared some of these quick and easy solutions to regain your access to your pages.
Hopefully, you were able to knock it off and get back access to your site.
Of course, if you need extra help with this, our WP experts can jump in and fix your issue.