Web Hosting Talk







View Full Version : Customizing Error Pages


Learner
09-28-2000, 03:49 PM
Could I customize all types of error pages, eg: 404, 405, etc. just by creating a .htaccess file which I upload in my root directory to redirect visitors to whichever page I specify in the .htaccess file?

I would like to create a customized 404 - Not Found page.

Could anyone please mention what the code would be like in the .htaccess file? Am attempting to do this for the very first time and would just like to make sure I am doing the correct thing.

Thanks in advance.

Learner

-Edward-
09-28-2000, 04:02 PM
This is what i put inside my .htaccess file.

ErrorDocument 401 /home/sites/www.kchat.org/web/401.html (Authorization Required Error)
ErrorDocument 403 /home/sites/www.kchat.org/web/403.html (Forbidden Error)
ErrorDocument 404 /home/sites/www.kchat.org/web/404.html (File Not Found Error)
ErrorDocument 500 /home/sites/www.kchat.org/web/500.html (Internal Server Error)

Learner
09-28-2000, 04:24 PM
Originally posted by Technics
This is what i put inside my .htaccess file.

Gee... thanks Technics!!!

Just wish to clarify... is that all one keys in to a .htaccess file?

What I am trying to really ask is whether there is possibly anything that should be inserted before such lines, or is this really it?

Also, what could be the other uses of a .htaccess file?

Learner

-Edward-
09-28-2000, 04:36 PM
If you already have a .htaccess file id suggest adding it too the top of your current one.

Learner
09-28-2000, 04:47 PM
So I plan to create one for the first time ever :)

Please let me know if there is anything wrong with my method below:

I key in the text using Notepad. Then I give this text/ascii file a temporary name (anything). Next I upload it to my server using my control panel. Then rename it to .htaccess

Is that correct?

Learner

-Edward-
09-28-2000, 04:56 PM
1st) Create the file in notepad.

2nd) Save it as .htaccess

3rd) Upload it via ftp using ascii mode but i dont think it matters if its done in binary.

4th ) upload a test 404.html file to see if it worked.

Normally works right first time unless i have the path wrong.

Learner
09-28-2000, 05:10 PM
I think I will try out the FTP method. If I remember correctly, some FTP programs don't display .htaccess files ... because it begins with a dot.

Oh well, I will now proceed to give CuteFTP a try!!!

Learner

Chicken
09-28-2000, 07:15 PM
To displaying a file that beings with a "." (hidden), enter "-a" in the REMOTE FILE MASK box (this might be under either 'startup' or 'option' somewhere. WS_FTP has a white box under 'MkDir' that you can just type this in as well, but not 100% sure of CuteFTP.

I'll try to dig up all the many things that .htaccess can do, but you can probably do a search and find something... you can redirect, passprotect dirs, add mime types, change the default file name for a dir., etc., etc.

kunal
09-29-2000, 01:58 AM
Learner you can check out
http://www.usask.ca/dcs/courses/cai/htaccess/toc.html

You can find the basics of htaccess here. :)

Learner
09-30-2000, 09:08 AM
Hey guys... Technics, Chicken and Kunal...

THANKS A LOT FOR YOUR INPUT HERE :)

With your posts here, I had no problem whatsoever. Creating a customized error page was a breeze :scatter:

Learner

Félix C.Courtemanche
09-30-2000, 04:06 PM
Apache ressources for mod_rewrite (which can be used in a .htaccess for cool stuff)

Rewrite Guide
http://apache.org/docs/misc/rewriteguide.html

Core Runtime configurations (error documents)
http://apache.org/docs/mod/core.html#errordocument

There is more, just look around once there :)

Learner
09-30-2000, 04:17 PM
I also appreciated your FANTASTIC SUGGESTION on the automatic propagation technique + the clarifications in the "Server Wide 404" thread you posted a moment ago :)

Learner

Duster
10-02-2000, 12:40 AM
Does anybody have a site bookmarked that explains all the server error codes ( like 404, 571, etc.)? I had one and lost it a few weeks ago.

Félix C.Courtemanche
10-02-2000, 01:20 AM
yep...
http://www.faqs.org/rfcs/rfc2068.html
the real reference :)
to find what yopua re looking, use 'search' in your browser and look for 404 or whatever... it will be faster than looking all around.

Duster
10-02-2000, 05:31 PM
Thank you. :wavey