A knowledge base for new webmasters

How to display a custom 401 error page

Your website displays a "401 Authorization Required" error whenever a user is unable to sign in to a password protected directory on your website. This could be because they clicked the "Cancel" button on the login window or entered the wrong password too many times.

Like most of the error pages web servers display, the default 401 error page isn't very user friendly. Fortunately, you can replace it with a page of your own. Your page could tell users how to look up their password or sign up for access.

Here's how to display your own 401 error page:

  1. Make the page you want to use for 401 errors and save it as 401.html.
  2. Open a text editor (e.g., Windows Notepad or TextPad), and type the line below:
    ErrorDocument 401 /401.html
  3. Save the file as .htaccess.
  4. Upload 401.html and .htaccess into the folder on your server where your website's home page is located.

Now whenever members or visitors can't log in, they'll see 401.html instead of the default 401 error page your server normally displays.