Click to See Complete Forum and Search --> : Custom Error Pages - Part 2


WhiteDragon
11-23-2008, 08:39 PM
Correct me If I'm wrong, but when you create custom error pages and you'd type in the path of a page the custom error page you created should show up, correct?

Then how come it shows up when I type a longer path but just in plain text ?

LeeU
11-24-2008, 03:55 PM
when I type a longer path but just in plain text ?
Not sure what you mean by "plain text".

WhiteDragon
11-24-2008, 06:19 PM
When I type in any URL path which relates to my server but does not exsit on my page it will load up, but not the custom error page with the colors or images I created originally but rather the custom error page in plain text, with no color just black & white.

How come this is occuring, shouldn't a custom error page show up how it originally was created no matter what the URL path is related to my server?

LeeU
11-25-2008, 08:21 AM
You you using PHP in the custom error file? Is it possible to post the code in the file and its name?

WhiteDragon
11-25-2008, 09:25 AM
www.walkfar.ca/paper.html (http://www.walkfar.ca/paper.html) This URL path the ERROR loads as it should.

www.walkfar.ca/test/paper.html (http://www.walkfar.ca/test/paper.html) This URL path the ERROR does not load as it should.

How come this happens ? Shouldn't the error message load the same no matte what the path is?

LeeU
11-25-2008, 09:39 AM
How are the "error page" specs set-up on your server? Is it done in an .htaccess file?

WhiteDragon
11-25-2008, 10:18 AM
It's setup on the server, as far as I know, no it's not done though a .htaccess file.

LeeU
11-25-2008, 10:39 AM
You would either need to get with you hosting company (because I'm not sure what is causing tyhe problem) or you could try this error script (http://web.archive.org/web/20070516205630/http://www.sabrewebdesign.com/support/scripts/errorpages.php). [Note, the URL is an archive as the site no longer exists.] It handles all errors (400, 500, etc.) and you can customize it. You would just need to set a command in the .htaccess file to use it instead of what your Web host has. I use it on many of my sites and it works great.

WhiteDragon
11-25-2008, 11:34 AM
Can you customize the look of this error page? Or do you copy and paste the script into the custom page that you created? And would I have to rename the error page to have a PHP extension instead of a HTML extension?

LeeU
11-25-2008, 03:50 PM
You can just copy it into a template of a page from your Web site. That way is will blend very nicely with your site.

If you check this page (http://www.shamar.org/find.php), all of the error info is from the script itself. You can leave the wording for the errors as it is in the script or you can customize it, as I did (including the picture and an image of my e-mail address, and a back link).

The instructions are included with the script. It's pretty easy to set-up.

WhiteDragon
11-25-2008, 08:51 PM
I take the script code and copy it into a HTML page that I have created and then it will work as it should? And I do this for each error page?

LeeU
11-26-2008, 08:57 AM
No, the script handles all the errors. It uses the switch statement to find the correct one and then it displays the proper message.

[I have been meaning to write a tutorial for this; I guess I need to now.]

WhiteDragon
11-26-2008, 11:04 AM
If you don't mind writting a tutorial I'm still lost but I will give it a try.

LeeU
11-26-2008, 11:27 AM
I wouldn't be able to write the tutorial for a few weeks. However, I'll tell you what. You supply the template for the page (a link to the site would also help), and I'll cover the scripting when I get back on Monday. You just need to make sure that your Web host allows you to have custom error pages, and that you can create/access an .htaccess file.

WhiteDragon
11-26-2008, 12:10 PM
What you need is each HTML error page, and that is it ? (A link to the site?)

LeeU
11-26-2008, 12:24 PM
No, just a "template" of what you would like the page to look like; in other words, a page from your site, with the "content" - the center area -- blank. You can PM me a link to your site, if you would rather keep it out of the discussion. That way, I will know what it should look like.