cPanel & Hosting How-Tos How to Fix a 401 Unauthorized Error
A 401 Unauthorized error means the page requires valid login credentials and didn’t get them. It’s most often a password-protected folder asking for a username and password. (Compare with a 403 Forbidden, which blocks access regardless of login.)
What causes a 401
- A password-protected directory (cPanel Directory Privacy / HTTP authentication).
- Wrong or forgotten credentials for that protected area.
- A corrupted or misconfigured
.htpasswd/.htaccessauth rule. - A security plugin protecting
wp-adminorwp-login.phpwith an extra password. - Stale cached credentials in the browser.
How to fix it
1. Manage the protected directory in cPanel
If you set up (or inherited) password protection, open cPanel Directory Privacy, select the folder, and either:
- Enter the correct username/password, or
- Reset the user’s password, or
- Untick “Password protect this directory” to remove protection entirely.
This is the cleanest fix because cPanel rewrites the .htaccess/.htpasswd for you correctly.
2. Check the .htaccess auth rules
If protection was added by hand, a wrong path in the AuthUserFile line breaks login. In File Manager (show hidden files), check the .htaccess in that folder points to a valid .htpasswd path — see .htaccess explained. When in doubt, remove the manual rules and redo it via Directory Privacy.
3. Clear cached credentials
Browsers remember HTTP auth. Clear your browser cache or test in a private window to make sure you’re not being rejected on old saved credentials — see clear your cache.
4. Check for a security plugin (WordPress)
Some security plugins add a second password to wp-admin or protect wp-login.php. If the 401 appears on login, check the plugin’s settings and enter or disable that extra protection. See common WordPress errors.
Still locked out?
If you can’t recall the credentials or the auth files are tangled, your error logs show which file is requesting authentication, and our support team can reset Directory Privacy for you.
Every Web Hosting, WordPress Hosting and Reseller Hosting plan at Genhost includes Directory Privacy and File Manager, so you can manage or remove a 401 prompt yourself.
Frequently asked questions
What does a 401 Unauthorized error mean?
It means the page requires valid login credentials and none were given, or the ones given were wrong. It's most often a password-protected directory (HTTP authentication) asking for a username and password.
How is a 401 different from a 403?
A 401 means 'you need to log in' — correct credentials would let you in. A 403 means 'access is forbidden' regardless of who you are. 401 is about authentication; 403 is about permission.
How do I remove the login prompt on my folder?
In cPanel, open Directory Privacy, select the folder, and untick 'Password protect this directory', or manage the users there. This removes the HTTP authentication that triggers the 401.