Custom Error Pages are not quite needed in websites, however they are very cool to use. You know those Internet Explorer
pages, that say 404 Not Found, when you click on an invalid link? Let's just say, that you can change the look of those
kinds of pages, and make them look like you would want them to look like. It gives a more personalized feeling to your website,
a nifty little feature to any website.
Step 1: First, you MUST make sure that your web
server allows you to upload ".htaccess" files. So be sure to check twice
that your web server allows you to upload ".htaccess" files.
Step 2: The next step is quite simple. There are three
different types of errors a website visitor can reach.
1. 404 error. Visitors reach this page when they click on a page
that no longer exists, or when they fool around with the URL, and try to go to some bogus page. Make your custom 404 page,
just the way you like it, with a nice layout and everything. Save that page as "404.html".
2. 403 error. Visitors reach
this page when they try to reach a page, that no visitor can access. The webmaster can still access this page, but the page
is forbidden to visitors. Make your custom 403 page, just the way you want it, and again, keep it with a nice layout and
everything. Save that page as "403.html".
3. 500 error. Visitors AND webmasters reach this page when the page is
completely forbidden, to everyone. Not even the webmaster can access this page. Again, make a custom 500 page with a decent
layout that you like. Obviously, save this page as "500.html".
Step 3: After saving all three of those custom error pages,
open up a word editor, such as Notepad or WordPad. Inside the text editor, type this:
ErrorDocument 403 http://www.your-domain.com/403.html
ErrorDocument 404 http://www.your-domain.com/404.html
ErrorDocument 500 http://www.your-domain.com/500.html
Make sure to edit "your-domain" to your actual domain address (obviously). Now save the page in
the text editor, as ".htaccess". When you save it, MAKE SURE to save it with "All Files", not just
"Text Documents". Make
sure the ".htaccess" page is saved in the "All Files" from the drop down menu.
Step 4: Now you're ready to upload. Upload
all the pages:
404.html
403.html
500.html
.htaccess into the same directory and also upload them in ASCII mode.
The
directory that you upload all the pages in must also be the directory that has your "index.html" page in it.
Next, to test
your new custom error pages, make up a dumb URL and check it out.
For example:
http://www.your-domain.com/very_stupid_thing_here. When you click on that, you should get your custom 404 error page!
There you have it, your very own error page. Have fun and make it nice. Good luck.
|