|
|
"404" - Custom Error Pages
How do I customize error messages for my site? You can customize error messages (404 Not Found, for example)
by creating a file called .htaccess and including the appropriate entries. This file should be uploaded to
your root directory (i.e., the "www" folder for your account).
Some of the most common messages are
as follows:
Error in Client 400 Bad syntax 401 Unauthorized 402 Not Used (Payment Granted)
403 Forbidden 404 Not Found
Error in Server 500 Internal Error 501 Not Implemented
502 Overloaded 503 Gateway Timeout
You can customize error messages for your site as follows:
Create the HTML page you want to use as your error message and upload it to your web directory
(/home/username/domain-www). Next, edit your .htaccess file (or create one using a text editor) and add
lines which specify the substitution.
Here are three examples of specifying error documents which
will be called for a given error condition (note that you can use relative "thisfile.html" or absolute
addressing "http://www.yourdomain.com/thisfile.html"):
ErrorDocument 401 http://yourdomain.com/nopassword.html ErrorDocument 403 /forbidden.html
ErrorDocument 404 http://www.yourdomain.com/nofile.html
Please note that Windows will not
allow you to create a file called .htaccess. It will be necessary to create this file using another name
and then rename it once you have uploaded it to your site.
If you use FrontPage to publish your web
page(s), custom .htaccess files cannot be used.
What are .htaccess files?
NOTE: Do not edit the .htaccess file if you are using MS Frontpage! Frontpage uses the
.htaccess file, and editing it may cause errors in your configuration.
The .htaccess file can
be placed in one or more of your /home/username/domainname-www subdirectories. Among other things, this
file can be used to restrict access to other files and web pages.
When a request for a web page
is made, the web server first checks for an .htaccess file. The server begins this check by looking for
.htaccess in the root of the current web directory, and on down the directory tree until it reaches the
the directory where the requested file resides. Since the placement of the .htaccess file determines
when it is executed, this fact can be used to restrict access only in certain subdirectories.
To
create an .htaccess file, make a text file as described below and upload it as ".htaccess" Except
for the first function, these will only work for an .htaccess file placed in $-www. Add whichever
functions you want to the same file.
How do I add mime types?
You can add mime types to your .htaccess file with a line like:
AddType text/html .xyz (in this example a
page titled "main.xyz" could be read by a web browser as a normal html page)
|
|
|