12 Useful HTML and Javascript Tricks (Part 2)
4. How to Make a Custom 404 Missing Page
Have you ever clicked on a link and received one of those '404 Not Found' errors?
These errors occur when the web page you're requesting is missing (the link might be
old, may have been typed in wrong, etc).
The larger your site gets, and the more often it's updated, the better the chances
that one of your own visitors may be faced with a '404 Not Found' error. Instead of
leaving them at that generic page, you can create a custom 404 page that ensures that
they stay at your site:
- Create a custom "error" page on your site. This is the page you want your visitors
to see if they ever get the '404 not found' error. You can put anything you like on it;
for instance, you could put a navigation menu on your custom 404 page to give visitors
an easy way to explore other parts of your website.
You upload this page to your website in the same way you do for any other page.
For the purposes of this example, assume you name this page notfound.html.
- Create a file called ".htaccess" (without the quotes, but WITH the leading period).
In this file, put the one line:
ErrorDocument 404 http://www.yourdomain.com/notfound.html
- Upload .htaccess to the main directory of your web space.
That's all there is to it! Now if a visitor should get a '404 not found' error
while trying to access a web page on your site, they'll see your custom 404 web
page instead. Use it to your advantage; you can redirect them back to your home
page, provide them with links to other sections of your website, put a subscription
form on it, etc.
Some web hosting packages offer a way to create your 404 page through a control panel
instead.
5. How to Create a Site Navigation Tool
A pull-down menu is a quick and easy way for your visitors to navigate through
your website. Your visitor simply has to click on the menu to display a list of
options. Once he or she has selected an option, they simply click on the "GO!"
button to be taken to the appropriate web page. Below is a simple example. It
shows a pull-down menu with a list of restaurant types (note: selecting any of
the options will keep you on this page):
The HTML looks like:
<FORM NAME="quicknav" METHOD=POST>
<SELECT NAME="navchoice" size=1>
<OPTION VALUE="http://www.yourUrl.com/">Select a restaurant type ...</OPTION>
<OPTION VALUE="http://www.yourUrl.com/pageName1.html">Fast Food</OPTION>
<OPTION VALUE="http://www.yourUrl.com/pageName2.html">Casual Dining</OPTION>
<OPTION VALUE="http://www.yourUrl.com/pageName3.html">Fine Dining</OPTION>
</SELECT>
<INPUT TYPE=button onClick="location=document.quicknav.navchoice.options[ document.quicknav.navchoice.selectedIndex ].value;" value="GO!">
</FORM>
</BLOCKQUOTE>
PREVIOUS: 12 Useful HTML and Javascript Tricks (Part 1)
NEXT: 12 Useful HTML and Javascript Tricks (Part 3)
© Copyright 2004, onlinebusinessbasics.com. All Rights Reserved.
Please contact us to request reprint permission.
|