httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <>
Subject Re: Free script for Apache
Date Thu, 07 Nov 1996 18:49:26 GMT

Hi Chris,

Thanks for the code. I'm not sure if we'll be able to use it as we're
not too keen on distributing CGI.. it's been known to come back and haunt

I'll pass the code on to the developers list to give it a fair chance.


Chris Roberts wrote:
>The following perl scrip I wrote an I offer it as a free part of the
>next apache distribution it is a quick hack but it works quite well and
>is low impact on the cpu.
>Chris Roberts
>DragonWare Internet Solutions
>We run Apache and have activated the missing page handler directive in
>the srm.conf file and have the following perl script installed in
>#Author: Chris Roberts
>#Date: 06-10-1996
>#REV:  2.01
>#This Script gets a missing page request and forwards it to a new
>#or displays an error message with the refering page!
>sub initIt{
>#change this to your web master's email address note the "\@\" must be
>in place!
># change the $redirectFile path as needed no other configuration is
>#redirect.dbf file format
># /directory/ (tab) http://www.fully.layed.out.domain/dir/ (tab)(cr)
>#Note: The Perl Script can manage this file via the web. 
>#Purchase it from DragonWare internet solutions for $50 USD 
>#un-comment for debug
>#print "Content-type: text/html\n\n";
>#print "From :$fromUrl<br>";
>#print "URL Called $missingUrl <br>";
>#print "NEW URL $newUrl<br>";
>sub mainProg{
>#if a missing url matches the list
>#call the redirectIt routine with the $newUrl
>open(URLSET, "$redirectFile") || print "Error opening $redirectFile
>        $buffer = <URLSET>;
>($redirectUrl, $newUrl) = split(/\t/,$buffer);
> if( $missingUrl eq  $redirectUrl )
>   {
>   close(URLSET);
>   &redirectIt;
>  return;
>   }
>  }
>  close(URLSET);
>sub notHere{
>print "Content-type: text/html\n\n";
><title> This File can not be found! </title>\r
><center><h1>This URL $serverBase$missingUrl Can't be located </h1><br>\r
><h2>Please contact the WebMaster of the refering URL<br>\r
><a href=$fromUrl> $fromUrl</a> and tell of the inaccurate link.</h2>\r
><a href=mailto:$webmaster>Your Webmaster</a>\r
>sub redirectIt{
>print "Status: 302 Moved Permanently\r
>Location: $newUrl\r\n\r\n";
>print "Content-type: text/html\n\n";
>print "<html><head><title>This resource has moved</title></head>\r
><body bgcolor=FFFFFF><h1>This resource has moved</h1>\n";
>print "the url $missingUrl has moved to <a
>------------------------------ cut here --------------------------------
>Change the srm.conf as follows
>#    2) local redirects
>#ErrorDocument 404 /missing.html
>#  to redirect to local url /missing.html
>ErrorDocument 404 /cgi-bin/
>#  n.b. can redirect to a script or a document using
>#    3) external redirects
>#ErrorDocument 402
>and it works!
>please advise if this can be used in the Apache distribution the script
>is avalible via anon ftp at:

Rob Hartill.       Internet Movie Database Ltd.  

View raw message