How to display a custom 401 error page
Your web host's server displays a "401 Authorization Required" error whenever a user can't login to a password protected directory on your website.
Like most of the default errors that servers display, the 401 error doesn't look very friendly. Fortunately, you can replace it with a page of your own. Your custom page could tell users how they can register for a username and password, or how to look up the password they already have.
Here's how to display your own 401 error page:- Create the page you would like to use when a 401 error occurs and save it as
401.html. - Open Windows Notepad, and type in the line below:
ErrorDocument 401 /401.html
- Save the file as
.htaccess. - Upload
401.htmland.htaccessinto the folder on your server where your website's home page is located.
Now whenever users can't login to a password protected directory, they'll see 401.html instead of the default 401 error page the server normally displays.