Introduction to the Apache Web Server - ApacheCon
Introduction to the Apache Web Server - ApacheCon
Introduction to the Apache Web Server - ApacheCon
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Then /cgi-bin/404.cgi will look like:<br />
#!/usr/bin/perl<br />
use Mail::Sendmail;<br />
use strict;<br />
my $message = qq~<br />
Document not found: $ENV{REQUEST_URI}<br />
Link was from: $ENV{HTTP_REFERER}<br />
~;<br />
my %mail = (<br />
To => ’admin@server.com’,<br />
From => ’website@server.com’,<br />
Subject => ’Broken link’,<br />
Message => $message,<br />
);<br />
sendmail(%mail);<br />
print "Content-type: text/html\n\n";<br />
print "Document not found. Admin has been notified";<br />
This is a good hands-on exercise for <strong>the</strong> students, in that it will suggest <strong>to</strong> <strong>the</strong>m things that <strong>the</strong>y can do in<br />
<strong>the</strong>ir own environment that will be more useful. The tests can be made conditional, or set up <strong>to</strong> send batch<br />
email ra<strong>the</strong>r than one per error, or o<strong>the</strong>r things. You may wish <strong>to</strong> implement a number of <strong>the</strong>se on your<br />
own, so that you can display a few example alternatives.<br />
8.12 Error documents in <strong>Apache</strong> 2.0<br />
<strong>Apache</strong> 2.0 has a new way of handling ErrorDocument that will mean much more cus<strong>to</strong>mizable error messages,<br />
ra<strong>the</strong>r than <strong>the</strong> same old boring ”Document Not Found” errors.<br />
In you <strong>Apache</strong> 2.0 default configuration file, you will see <strong>the</strong> following:<br />
47