Custom Error Pages - what I've done
This WebDNA talk-list message is from 1998
It keeps the original formatting.
numero = 19287
interpreted = N
texte = Following up on some suggestions made by Ken and Britt (thanks asalways...) I have been working up a strategy to serve out custom errorpages versus the generic Template not found message which is WebCat'sdefault. In order to save new users from the learning curve I thought I'dshare what I've done. Comments/criticisms are humbly accepted...SCENARIO #1: You want to serve up a single custom File not found file forall folders or vhosts on your server.SCENARIO #2: You want to allow users to have their own customized File notfound error page specifc to their site (or vhost) but in case this file isnot present, have WebCat serve up a more generic (but still customized)File not found file.-------------------------------HOW TO:SCENARIO #1 Single customizable error page:This is obviously pretty simple - Simply go to your errormessages.db fileand modify the TemplateNotFound error message to something like this:TemplateNotFound [Include /error.html]Where error.html (or error.tmpl or whatever you wish to call the defaulterror page) is your customized File not found file --- be sure to placethis file in the root of your web server. That's it, once you have flushedout the old errormessages.db and replaced it with your new version, anymissing page requests will recieve this same customizable error.html file.IMPORTANT NOTE: Correctly specifying the path to the location of yourincluded default error.html file is absolutely critical - if you do notspecify this properly (or forget to add the file) then you will beliterally telling WebCat that in case of a missing file, serve up anotherfile which is also missing etc. etc. -- this creates a nasty WebCatprocessing loop (bad - very bad...)SCENARIO #2 Folder-specific error pages:The only trick here is that when we recieve a request for a non-existentfile we will first look into the current folder to see if an error.htmlfile exists and if so, serve it up, and if it doesn't exist, then we willserve up the server's main defaulterror.html file. So, if a hosting clientwants to make sure that only their customized error.html files are servedl,then they will have to place a copy of their error.html file into eachsubdirectory of their site - if it is missing then the server's defaultfile gets served.WEB SERVER ROOT FOLDER | |-defaulterror.html (server default) | |---WebSite1.com | |- error.html (website1's custom error page) | |-whatever other html is here | |_ subdirectory1 | |- error.html (website1's custom errorpage or some derivative) | |- whatever other html is here |---WebSite2.com |- error.html (website2's custom error page) |-whatever other html is hereNow add the replace the TemplateNotFound line in your errormessages.db withthe following code:[showif [FILEINFO error.html][EXISTS][/FILEINFO]=T][includeerror.html][/showif][showif [FILEINFO error.html][EXISTS][/FILEINFO]!T][include/defaulterror.html][/showif]NOTE: Although I left the two [showif] contextsare seperated by a carriagereturn in the example above (just for visual clarity) the code will notwork correctly until you remove all unnecessary spaces and carriage returns.Again, make sure you have flushed out your old errormessages.db andreplaced it with your new one as well as properly added all of your errorpages.IMPORTANT NOTE (again- applies here as well): Correctly specifying the pathto the location of your included default error file is absolutely critical- if you do not specify this properly (or forget to add the file) then youwill be literally telling WebCat that in case of a missing file, serve upanother file which is also missing etc. etc. -- this creates a nasty WebCatprocessing loop (bad - very bad...)Of course now that we have WebCat serving up html files instead of ageneric message we can go crazy with adding other WebCat tags and commandsto our error pages including things like capturing referrer info andautomatically logging missing files or generating e-mails to notifywebmasters of bad/missing links etc etc.I hope somebody finds this useful. Any comments or suggestions/correctionsare appreciated.-Marty --------------------------------- Marty Schmid -Artwerks- e-mail: marty@artwerks.com ---------------------------------
Associated Messages, from the most recent to the oldest:
|
- Custom Error Pages - what I've done (Marty Schmid 1998)
|
Following up on some suggestions made by Ken and Britt (thanks asalways...) I have been working up a strategy to serve out custom errorpages versus the generic Template not found message which is WebCat'sdefault. In order to save new users from the learning curve I thought I'dshare what I've done. Comments/criticisms are humbly accepted...SCENARIO #1: You want to serve up a single custom File not found file forall folders or vhosts on your server.SCENARIO #2: You want to allow users to have their own customized File notfound error page specifc to their site (or vhost) but in case this file isnot present, have WebCat serve up a more generic (but still customized)File not found file.-------------------------------HOW TO:SCENARIO #1 Single customizable error page:This is obviously pretty simple - Simply go to your errormessages.db fileand modify the TemplateNotFound error message to something like this:TemplateNotFound [Include /error.html]Where error.html (or error.tmpl or whatever you wish to call the defaulterror page) is your customized File not found file --- be sure to placethis file in the root of your web server. That's it, once you have flushedout the old errormessages.db and replaced it with your new version, anymissing page requests will recieve this same customizable error.html file.IMPORTANT NOTE: Correctly specifying the path to the location of yourincluded default error.html file is absolutely critical - if you do notspecify this properly (or forget to add the file) then you will beliterally telling WebCat that in case of a missing file, serve up anotherfile which is also missing etc. etc. -- this creates a nasty WebCatprocessing loop (bad - very bad...)SCENARIO #2 Folder-specific error pages:The only trick here is that when we recieve a request for a non-existentfile we will first look into the current folder to see if an error.htmlfile exists and if so, serve it up, and if it doesn't exist, then we willserve up the server's main defaulterror.html file. So, if a hosting clientwants to make sure that only their customized error.html files are servedl,then they will have to place a copy of their error.html file into eachsubdirectory of their site - if it is missing then the server's defaultfile gets served.WEB SERVER ROOT FOLDER | |-defaulterror.html (server default) | |---WebSite1.com | |- error.html (website1's custom error page) | |-whatever other html is here | |_ subdirectory1 | |- error.html (website1's custom errorpage or some derivative) | |- whatever other html is here |---WebSite2.com |- error.html (website2's custom error page) |-whatever other html is hereNow add the replace the TemplateNotFound line in your errormessages.db withthe following code:[showif [FILEINFO error.html][EXISTS][/FILEINFO]=T][includeerror.html][/showif][showif [FILEINFO error.html][EXISTS][/FILEINFO]!T][include/defaulterror.html][/showif]NOTE: Although I left the two
[showif] contextsare seperated by a carriagereturn in the example above (just for visual clarity) the code will notwork correctly until you remove all unnecessary spaces and carriage returns.Again, make sure you have flushed out your old errormessages.db andreplaced it with your new one as well as properly added all of your errorpages.IMPORTANT NOTE (again- applies here as well): Correctly specifying the pathto the location of your included default error file is absolutely critical- if you do not specify this properly (or forget to add the file) then youwill be literally telling WebCat that in case of a missing file, serve upanother file which is also missing etc. etc. -- this creates a nasty WebCatprocessing loop (bad - very bad...)Of course now that we have WebCat serving up html files instead of ageneric message we can go crazy with adding other WebCat tags and commandsto our error pages including things like capturing referrer info andautomatically logging missing files or generating e-mails to notifywebmasters of bad/missing links etc etc.I hope somebody finds this useful. Any comments or suggestions/correctionsare appreciated.-Marty --------------------------------- Marty Schmid -Artwerks- e-mail: marty@artwerks.com ---------------------------------
Marty Schmid
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
any suggestions for creating a multi-lingual site? (1999)
Banners (1997)
Another XML Questgion (2000)
Sequential Code Logic (2003)
Documentation Feedback (1997)
Show only certain items (2002)
[WriteFile] problems (1997)
How can I Add several Items into the cart at once? (1997)
instant cookies? (1999)
Apple event reply error (-1) (1997)
OT: Google (2002)
4.5 on Apache 2 (2005)
Showing unopened cart (1997)
For those of you not on the WebCatalog Beta... (1997)
Late on Friday.... brain fried (2002)
Webcatalog quitting (1997)
RE: [WebDNA] [OT] Best Mail Server (2011)
WebCat for mass emailings (1997)
So what ya working on? (or have you completed?) (2004)
Mac 2.1b2 speed (1997)