[Chicago-talk] Generate a 404 error from a perl script

Jim Jacobus JJacobus at PonyX.com
Wed Dec 23 09:43:15 PST 2015

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.
Background: I have a script that is indexed by all the search 
engines. It has a parameter which is a item number (e.g. 
http://example.com/cgi-bin/script.pl?nnnnnn ) 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.

I thought there was a simple print statement I needed to write out, 
but I'm having trouble figuring out what it is.
Thanks in advance.

More information about the Chicago-talk mailing list