[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom error handling

For some reason I seem to have missed the original posting, anyhow:

> hagani@worldnet.att.net schrieb:
> > 
> > Excellent product - keep up the good work, John.
Thank you.
> > 
> > I'm having a hard time figuring out how I can use my own perl script
> > to handle a 404 Not Found situation.
> > 
> > Specifically, how should I modify the CONFIG.PI3 file so that instead
> > of loading "/errors/404.ssi", my script "/cgi-bin/404.pl" is called?
Apart from Holgers solution below - which is also valid - though 
possibly requires a certain browser compatibility level (just when was
the meta-refresh thing introduced?) what you have tried to do is 100%
correct. I've just verified it myself.

The only things I can suggest:
	- Make sure you explicitly check /cgi-bin/404.pl from the browser to
	make sure there isn't some problem with this.

	- Check quotes (") are matched.

	- Make sure your favourite text editor does not insert spurious 
	whitespace characters on continued lines (lines ending in '\')

	- You may not have comments (lines starting with #) in continued lines -
	because its parsed like a single line. I have a feeling you commented
	out the old 404='/erros/404.ssi" and inserted your own just after -
	this would cause just the problem you describe. Delete the old 404= line
	or move it outside the sequence of continued lines that make up
	the 'Mapping MapToErrorDocument ...' definition.

	- Following from the previous point try not using line continuation - so
	you should have a single long line like:
	Mapping MapToErrorDocument 301="/errors/301.ssi" 404="/cgi-bin/404.pl" 
	( of course I've left a lot out).

So in conclusion, it does work I just tried it (with my own /cgi-bin/404.pl)
but watch those line continuations.

Hope this helps.


Also note that Holgers solution is good for those 'delayed' refresh uses
that are being used more and more - .i.e. display the 404 Error message for
5 seconds then bring up the home page.

> > 
> Hi,
> I had a similar problem: How to generate the actual view of a dynamic HTML-
> form from the script parsing the form data? I solved it with a HTML-Meta tag
> to call the form generating script again:
> <HEAD>
> <meta http-equiv="refresh" content="0; URL=myscript.pl?param1&param2"> 
> </HEAD>
> Pay attention to the position of the double quotes in this meta-tag.
> If you put this in your 404-handling HTML-document it should call the
> given script. You will see a blank page for a short time in your browser
> when the 404-document is loaded and then at once the result of the
> script execution if it produces dynamic HTML.
> > I have mapped /cgi-bin/ successfully, but any change I seem to make to
> > the Mapping MapToErrorDocument section causes the server to gag when I
> > start it up (undefined directive ", or something similar to that).
> ^^^^ If you make it as I suggested leave the rest and it should work.
> > 
> > Thanks a million!
> > 
> > Jim
> -- 
> with regards
> Holger
> ---------------------------------------------------------
> Holger 'Zimpel' Zimmermann    Contact me:
> ---------------------------------------------------------
> Wendishain                    tel./fax company: on demand
> Germany                       tel./fax private: on demand
> ---------------------------------------------------------
> homepage: http://home.t-online.de/home/zimpel@t-online.de
> web server: surf to it from my homepage (online every
>             Sunday 20:00-24:00 GMT, start 1. June 1998)
> e-Mail:     zimpel@t-online.de
> --------------------------------------------------------