#!/usr/local/bin/perl # Program name: not_found.cgi # Installed in: /programs/messages/ # Runs on: all our unix web servers # Author: Rajiv Pant (Betul) http://rajiv.org betul@rajiv.org # Version: 2.0. (Updated for make_dbm_of_urls) 1996/Sep/22 # Note: You will need to adjust all folder locations in this program # to suit your system. BEGIN { $| = 1 } # ---- Libraries used ---- require 5.003 ; use File::Find ; # Part of standard perl distribution. use Fcntl ; # Part of standard perl distribution. # See not about DB_File in the companion program make-dbm-of-urls use DB_File ; # Part of standard perl distribution. # ---- /Libraries used ---- # --- Directories and files --- # This is the web server's document root. If you would like this # program to handle some other virtual roots too, you should list # them here. $document_root = '/inet/web' ; # $indices_dir is where the search indexes and some related files # are stored. $indices_dir = '/inet/index' ; # $dbm_of_urls is the name of the dbm that will contain this hash # table (associative array) of all lowercase urls to their real # path names. $dbm_of_urls = $indices_dir . '/dbm_of_urls' ; # --- /Directories and files --- # --- Reading CGI values --- # In a server API version of this program, read in the corresponding # values. $referer = $ENV{'HTTP_REFERER'} ; $server_name = $ENV{'SERVER_NAME'} ; ($referer_server) = $referer =~ m%[A-Za-z]+://([^/]+)/% ; $path_info = $ENV{'PATH_INFO'} ; $path_info = $ENV{'REDIRECT_URL'} unless $path_info ; ($in_lower_case) = $path_info =~ /^\/(.*)$/ ; $in_lower_case =~ tr/A-Z/a-z/ ; # --- /Reading CGI values --- tie %dbm_of_urls, DB_File, $dbm_of_urls, O_READ, 0 ; $url = $dbm_of_urls{$in_lower_case} ; untie %dbm_of_urls ; if ($url) { print < The page you requested is at: /$url The page you asked for, /$path_info is located at /$url. Your browser should have taken you there automatically. EOM exit ; } # else continuing with regular error handling ... print < $path_info not found on $server_name

The page $path_info you requested could not be found on $server_name

EOM if ($referer eq '') { print <http://$server_name$path_info you have typed in is accurate.

If you have come here via an old bookmark you had made on our site, it is possible that the page has been deleted or moved or was a part of a virtual space. In that case, you may want to look for it on our site again. EOM } elsif ($referer =~ /\.rajiv\.com/) { print <send us an email that the $referer page on our site contains an incorrect link to $path_info. EOM } else { print <$path_info link from the site $referer_server.

We would appriciate it if you could email the maintainer of the page $referer about this incorrect link to http://$server_name$path_info.

You may find the email address on that site, or you may try sending to webmaster\@$referer_server. EOM } print < You may find the information you are looking for via our

  • Search System
  • Table of Contents
    online.staff\@rajiv.com
    EOM