<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Take a look at this example:<div class=""><br class=""></div><div class=""><a href="http://www.oreilly.com/openbook/cgi/ch03_07.html" class="">http://www.oreilly.com/openbook/cgi/ch03_07.html</a></div><div class=""><br class=""></div><div class=""><div class="screen" style="font-family: Times; font-size: medium; line-height: normal; widows: 1; background-color: rgb(255, 255, 255);"><pre class="">#!/usr/local/bin/perl
$remote_host = $ENV{'REMOTE_HOST'};
print "Content-type: text/plain", "\n";
if ($remote_host eq "<a href="http://bu.edu" class="">bu.edu</a>") {
        print "Status: 200 OK", "\n\n";
        print "Great! You are from Boston University!", "\n";
} else {
        print "Status: 400 Bad Request", "\n\n";
        print "Sorry! You need to access this from Boston University!", "\n";
}
exit (0);
</pre><div class=""><br class=""></div></div><div class="">
-Don</div><div class=""><br class="">--<br class="">Don Drake<br class=""><a href="http://www.drakeconsulting.com" class="">www.drakeconsulting.com</a><br class="">www.maillaunder.com<br class="">312-560-1574<br class="">800-733-2143

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Dec 23, 2015, at 11:43 AM, Jim Jacobus <<a href="mailto:JJacobus@ponyx.com" class="">JJacobus@PonyX.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">How to I create a 404 error from a cgi-bin script. I know the message needs to be before any other text, but I'm having trouble with this.<br class="">Background: I have a script that is indexed by all the search engines. It has a parameter which is a item number (e.g. <a href="http://example.com/cgi-bin/script.pl?nnnnnn" class="">http://example.com/cgi-bin/script.pl?nnnnnn</a> ) where nnnnnn is a item number. The script figures out if this is a current item number and forwards it to an HTML page if it is. If it isn't a current item number, I create a page that is a similar product. The item numbers (nnnnnn) are added and deleted all the time. I want the search engines to stop indexing expired items, so I want to create a 404 error but still produce a page for the end user.<br class=""><br class="">I thought there was a simple print statement I needed to write out, but I'm having trouble figuring out what it is.<br class="">Thanks in advance.<br class="">Jim<br class=""><br class="">_______________________________________________<br class="">Chicago-talk mailing list<br class=""><a href="mailto:Chicago-talk@pm.org" class="">Chicago-talk@pm.org</a><br class="">http://mail.pm.org/mailman/listinfo/chicago-talk<br class=""></div></div></blockquote></div><br class=""></div></body></html>