Forum Moderators: phranque

Message Too Old, No Replies

Forcing a Server Header

Need 404 Error for certain pages

         

rover

4:47 pm on Jun 30, 2004 (gmt 0)

10+ Year Member



We have pages on our site that are generated dynamically and indexed with major search engines.

In some cases data gets removed for a specific page so that the page is no longer available. In that case our perl program produces an error page that says something like:

This page is no longer available...

My concern is that the page returns a normal 200 server header code so I think that the search engines will see it as a valid page. So, if I have several hundred versions of this error page indexed by search engines, I think it would be a problem.

Does anyone know if there any way that I can force the server header to be 404 for a dynamically generated page like this, so that the search engines won't index it?

volatilegx

4:54 pm on Jun 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes,

Send content without the Content-type: header.

Birdman

5:00 pm on Jun 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add this before any other output in the script:

print "Status: 404 Not Found\n";
print "Content-type: text/html\n";

jdMorgan

5:13 pm on Jun 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Birdman beat me to it: [hk8.org...]

Jim

rover

5:17 pm on Jun 30, 2004 (gmt 0)

10+ Year Member



Add this before any other output in the script:
print "Status: 404 Not Found\n";
print "Content-type: text/html\n";

Thanks very much. I tried this option and checked with the Server Header Checker and the SimSpider, and both now show these pages as 404 errors which I needed. I appreciate the help.