Web Design Specialists. |
Using .htaccess
|
Two examples of the .htaccess scripts power.
1. Create Custom Error Pages
We'll start with the most common use for this file, creating custom error pages. Your first step will be to actually design the custom error pages for your web site. These error pages should have the same look and feel as your overall web site, while informing the visitor that they are experiencing an error.
The most common error pages are 404, 401 and 500. You aren't limited to these errors as you can create an error page for each and every error possible.
Open up an ASCII text editor such as windows notepad and starting from the top of your page, key in the following lines:
ErrorDocument 404 http://www.yourdomain.com/404.html
ErrorDocument 401 http://www.yourdomain.com/401.html
ErrorDocument 500 http://www.yourdomain.com/500.html
Replace the URL's above with the error pages you have just created and uploaded. Save it as .htaccess.txt and then upload it to your server. This file is uploaded into the root of your public_html directory. Be sure it is uploaded in ASCII form. After doing that, you should use your ftp client and rename the file to it's proper name which is just .htaccess without the .txt extension.
Now any errors that occur will be directed to the appropriate error page.
2. Enable .htm, .html pages to be parsed for SSI
You can use *.htm and *.html pages with SSI. It will require you to either reopen the .htaccess file or create a new one. Lets add to the original .htaccess file that we create above.
Open your text editor, then open the file that contains your .htaccess commands. Now below the existing lines key the following lines.
AddType text/html .shtml .shtm .html .htm AddHandler server-parsed .shtml .shtm .html .htm
Then save it as .htaccess and upload to the root directory
of your public_html in ASCII mode. That's it, now the
extensions .html and .htm can be used with SSI.
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z