Re: [WebDNA] Solution to dynamic error pages on Apache

This WebDNA talk-list message is from

2011


It keeps the original formatting.
numero = 107443
interpreted = N
texte = Damn, crossed in the post Paul On 28 Sep 2011, at 13:06, Kenneth Grome wrote: > Hi Tom, > > Thanks for the reply. I actually solved this problem a long > time ago, but it's been so long that I forgot how I did it > until last night ... > > The solution is simple. Just replace the value in the > Message field of the TemplateNotFound record in the > ErrorMessages.db with this [include /error.tpl] tag. Then > put this line into the .htaccess file that resides in the > website's document root folder: > > ErrorDocument 404 /error.html > > Apparently that's all it takes on WebDNA 6.x and Apache to > insure that all 404 errors on the entire website are handled > by the /error.tpl file. > > What's nice about this is that a [thisurl] tag inside the > /errors.tpl file returns the original request URL, not the > URL of the error page ... so we know which page each visitor > was trying to retrieve. This means we can silently redirect > him to the new destinations of a recently moved page -- or > post our own custom error message when the page truly does > not exist. > > Ony one problem with this method, it won't work if your host > has you on a shared webdna server (without your own sandbox) > and will not give you access to the ErrorMessages.db. So it > is much better to have your own sandbox where you can edit > your own ErrorMessages.db and not affect anyone else's webdna > sites on the same server. > > :) > > This solution works fine for non-existing pages with webdna > suffixes. But when a non-existing file with a NON-webdna suffix > is requested, the following webdna error is appended to the > bottom of the /error.tpl page: > > Error: template security preferences do not allow remote > access to files with that extension > > This error should be easy to eliminate by getting rid of the > value in the Message field of the TemplateSecurity record in > the ErrorMessages.db. Just make this field blank/empty to > suppress it. > > Or if you prefer to hide this error only on the /error.tpl > page you can try putting a beginning HTML comment tag > immediately after the include tag in the ErrorMessages.db > like this: > > [include /error.tpl]