1. How do I setup Redirects?
2. How do I customize error messages for my site?
3. How do I add mime types?
4. What are .htaccess files?
1. How do I setup Redirects?
Redirecting allows you to send the user to, for example, 'new.html
' when they attempt to access 'old.html'.
To see this example in practice, simply add the following line
(This should be typed as one
single line without breaks) to the '.htaccess' file:
2. How do I customize error messages for my site? - Top
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
402 Not Used (Payment Granted)
404 Not Found
Error in Server
500 Internal Error
501 Not Implemented
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/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
ErrorDocument 401 http://yourdomain.com/nopasswordd.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.
3. How do I add mime types? - Top
You can add mime types to your .htaccess file with a line like:
AddType text/html .txt
4. What are .htaccess files? - Top
Important 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/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.