httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject [FWD] Can you help with a ErrorDocument CGI problem?
Date Fri, 23 Oct 1998 09:53:47 GMT

Not acked. I'm totally busy with other stuff and
perhaps someone other has a few hints for him.

----- Forwarded message from Michael Budash <mbudash@sonic.net> -----
Date: Fri, 23 Oct 1998 02:43:58 -0700
From: Michael Budash <mbudash@sonic.net>
Reply-To: mbudash@sonic.net
Organization: Michael Budash Consulting
To: rse@engelschall.com
Subject: Can you help with a ErrorDocument CGI problem?

Sir -
I know you're a busy guy, so if you can't help here, just say so...

I'm trying to write a perl ErrorDocument CGI for the 404 error message. 
Eventually I want it to redirect to a url looked up in a table keyed by
the value of the REQUEST_URI environment variable (if not found in the table,
 show a standard-looking 404 page). For now I'm leaving the table
lookup out of it, and simply testing with 'http://domain.com/budash'.

It does run, but it
won't redirect using a Location: header. It instead tries to download a
file called 'budash' of type 'application/x-httpd-cgi' or something like that!
 I've tried some variations using non-parsed-headers, and it's no-go there
either. 

I'd appreciate any feedback at all as to what I might be doing wrong. I've
already been to the Apache site, but didn't really see anything I could
use.

Thanks in advance. Here's what I've got:

#!/usr/bin/perl5

$|++; # autoflush stdout

$URI = substr($ENV{'REQUEST_URI'},1); # strip leading '/'

if ($URI eq 'budash') {
 print "Location: http://www.sonic.net/~mbudash\r\n\r\n";
 }

else {
print qq|Content-type: text/html

<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL $ENV{'SERVER_NAME'}$ENV{'REQUEST_URI'} was not found on
this server.
</BODY></HTML>
|;
 }

-- 
@-----------------------------@--------------------@
| Michael Budash Consulting   | 707-255-5371       |
| Perl, Javascript, Html      | 707-258-7800 x7736 |
| Official Extropia Developer | mbudash@sonic.net  |
@-----------------------------@--------------------@
----- End forwarded message -----

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message