Home › Knowledgebase › KB-1196

Why Your Website Is Returning a 401 Unauthorized Error and How to Fix It

Summary

This guide helps you troubleshoot and resolve: Why Your Website Is Returning a 401 Unauthorized Error and How to Fix It. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

A 401 Unauthorized error means your web server understands the request but refuses to authorise it. This usually happens when a visitor tries to access a password-protected page, directory, or admin area without providing valid credentials. Unlike a 403 Forbidden error, a 401 error suggests that authentication is possible but has either not been attempted or has failed. For small business websites, this most commonly affects WordPress admin panels, cPanel directories, or areas protected by .htaccess password rules.

Quick Fix Steps

  1. Refresh the page to ensure the error is not caused by a temporary glitch.
  2. Clear your browser cache and cookies to remove outdated or corrupted authentication data.
  3. Try accessing the site in an incognito or private browsing window.
  4. Verify that you are entering the correct username and password for the protected area.
  5. If you recently changed your password, update any saved credentials in your browser or password manager.

Detailed Instructions

Clear Browser Cache and Cookies

  1. Open your browser settings.
  2. Navigate to the Privacy and Security section.
  3. Select Clear browsing data or Clear history.
  4. Ensure Cookies and other site data and Cached images and files are selected.
  5. Choose All time as the time range.
  6. Click Clear data or Clear now.
  7. Restart your browser and try accessing the website again.

Check .htaccess Password Protection

  1. Connect to your hosting account using FTP or your hosting control panel's File Manager.
  2. Navigate to the directory that is returning the 401 error.
  3. Look for a file named .htaccess. If you cannot see it, enable the option to show hidden files.
  4. Download a backup copy of the .htaccess file to your computer before making any changes.
  5. Open .htaccess in a text editor and look for lines containing AuthType, AuthName, AuthUserFile, and Require valid-user.
  6. If these lines are present, the directory is protected by HTTP Basic Authentication.
  7. Verify that the AuthUserFile path points to a valid .htpasswd file on your server.
  8. If you suspect the .htaccess file is causing the issue, temporarily rename it (for example, to .htaccess_backup) to test if access is restored.
  9. Save the file and refresh your website.
Editing .htaccess incorrectly can make your website inaccessible. Always download a backup copy of the file before making changes.

Verify Password File Path

  1. In the same .htaccess file, locate the AuthUserFile directive.
  2. Ensure the file path points to a valid .htpasswd file on your server.
  3. Check that the .htpasswd file has the correct permissions (typically 644) so the web server can read it.
  4. If the path is incorrect or the file has been moved, update it to the correct location.
  5. Save the file and test access again.

Reset CMS Admin Credentials

  1. If the 401 error occurs on your WordPress or other CMS login page, use the Forgot Password link to reset your credentials.
  2. Check your email, including the spam folder, for the password reset link.
  3. Log in with the new password and ensure your browser does not auto-fill an old, incorrect password.

Troubleshooting

Check for IP or User Restrictions

Some hosting configurations restrict access to admin areas by IP address. If your IP address has changed or is not on the allowed list, you may receive a 401 error. Review your .htaccess file or hosting control panel security settings for any Deny from or Require ip rules that might be blocking your connection.

Disable Security Plugins Temporarily

If you use a content management system like WordPress, security plugins can sometimes trigger 401 errors by blocking login attempts. Access your site via FTP, navigate to the wp-content/plugins folder, and rename the folder of your security plugin to disable it. Try logging in again. If successful, reconfigure the plugin settings or contact the plugin developer.

Contact Your Hosting Provider

If none of the above steps resolve the issue, the problem may be on the server side. Your hosting provider can check server logs to identify why authentication is failing and help restore access to your website.

A 401 error is different from a 403 Forbidden error. A 401 means authentication is required but missing or incorrect, while a 403 means the server understands who you are but is refusing access regardless.

If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.

If you continue to experience a 401 Unauthorized error after following these steps, Open a Ticket with our support team for further assistance.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket