Custom
404 Page Not Found Pages
by redViper
:: 16 March 2004
A cool trick you can entice your visitors
with is custom error pages. When a page on your server is
not found, your visitors will normally see their browser's
default message such as "Page cannot be displayed." If you
used a custom error page though, your visitors will see your
page. For example, click on the following link and see the
kirupa.com site's custom 404 page:
http://www.kirupa.com/blah.htm
404 Error pages will ONLY work if you are
using it on a domain. Sub-domains (something.your-site.com
or
http://www.your-site.com/something) will NOT work.
Here's How:
-
Create an HTML file for
your 404 page. It could be anything you would like. It
could be just simply 404 on a blank page.. or it could be
your layout that includes the 404 words in it.. it's all
up to you.
-
Save that file in any file
format you want (html, php etc;) and upload it to your
webserver. You can either keep it in your main or root
directory, or you can create a subfolder. If you're only
going to be using one (404) then I suggest just leaving it
in your root folder.
-
Press start > Run > type
"notepad" (in mac, just open a text editor) now you will
take this code below, and put it into your text editor:
ErrorDocument 404
http://www.yoursite.com/404.htm
-
Remember, change the URL in
the above code to the path of your 404 page on your
server.
-
Now file > save as >
htaccess.txt | save it somewhere that you will remember.
-
Upload the HTACCESS.TXT
folder to your webserver. (Make sure it's in the home or
root directory)
-
Rename the file (will be
different for different ftp clients) to
.HTACCESS (make sure there is a "."
before HTACCESS and NO ".txt" after HTACCESS)
-
And there you go! You
should be good to go. There are also other error pages
available such as internal error, forbidden etc; search
google for these .. and then its just a matter of adding
that code to your .htaccess file and making another error
document (like your 404 page).
Any questions? PM redViper in
the forums.
Regards,
|