Manual Set a 404 Header

So this is one of those posts where I blog something to remember it for that inevitable day when the same problem will plague me years down the road.

The issue is that google doesn’t like custom error pages and keeps them in their index without establishing that in fact they are bad pages that drag down the overall quality of a website. For a dynamic, database-driven site, inevitably the info on a website changes over time. Generating pages that forward on to the new version, or give an informative error message help visitors stay on track on the website without getting too terribly lost. The following line of code helps tell google that, whatever’s happened to the page it’s looking for, it’s not there now.

<cfheader statuscode=”404″ statustext=”File Not Found”></cfheader>

As long as you’re at it, you might as well have the page sending you a message about the error so you can go hunt it down and fix it for future users.

<cfmail to=”” subject=”Error: Outdated or Invalid link” from=”” type=”html”><br />Someone just encountered the following error:</cfmail>




Offending Script: #cgi.SCRIPT_NAME#

Query Info: #cgi.QUERY_STRING#

Referring Page: #cgi.HTTP_REFERER#

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s