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.html and
.htaccess
into the folder on your server where your website's home
page is located.

How to display a custom 404 error page
Your web host's server displays a "404 File Not
Found" 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 404 error page:
- Create the page you would like to use when a 404
error occurs and save it as
404.html.
- Open Windows Notepad, and type in the line
below:
ErrorDocument 404 /404.html
- Save the file as
.htaccess
- Upload
404.html
and
.htaccess into the folder on your
server where your website's home page is located.

How to prevent users from viewing your
.htaccess files
Preventing visitors from being able to view
the contents of your .htaccess files can add
another layer of security to your website. Some
web servers are already configured to block
access to .htaccess files. If yours isn't, just
add the four lines below to all of your
.htaccess files:
<Files .htaccess>
order allow,deny
deny from all
</Files>
Visitors will now get a "403 Forbidden" error
whenever they try to look inside a .htaccess
file.

How to prevent users from listing files in
your directories
Many web servers are configured to prevent
visitors from listing files in directories that
don't contain an index file. Here's what you can
do if yours isn't:
- Open Windows Notepad, and type in the
line below:
Options All -Indexes
- Save the file as
.htaccess
- Upload
.htaccess into the folder on
your server where your website's home page
is located.
From on now on, your server should respond
with a "403 Forbidden" error when a visitor
tries to access any directory that doesn't
contain an index file.