This is one of those techniques that I’ve been using for years, and only just discovered a simple mistake in it. However, I think this mistake might be quite common, so decided to blog about it.
If you’re using ColdFusion and IIS as the webserver, you can either use IIS’s default page for handling 404 (page not found) errors (and any other error type). Or you can specify a page of your own. By specifying your own page it makes it easy for you to have a 404 page that matches the design and functionality of your website.
To do this is simple. In IIS, go to the Properties screen for your website. Go to the Custom Errors tab. There you will see a list of all different types of errors you might generate. Scroll down the list until you find the 404 error.

Select it and click Edit. Change the type to URL, then put in the relative path to your own 404 page.
Simple, right? You’ll see the above method in many ColdFusion articles, and I’ve done it like this for years. However, there’s one vital step being missed out. I only discovered this when trying to register my site for Google Webmaster Tools. You have to verify your site by uploading an HTML file or adding a custom meta tag to an existing page. However it seems the Google bot also checks your 404 page at the same time. I got the following error message:
We’ve detected that your 404 (file not found) error page returns a status of 200 (Success) in the header.
?! To check this, I went to mysite.com/blah, then using the Web Developer Toolbar in Firefox, checked View Response Headers. Which gave me the following information:
Connection: close
Date: Wed, 25 Mar 2009 20:41:55 GMT
Server: Microsoft-IIS/6.0
Content-Type: text/html
Page-Completion-Status: Normal, Normal200 OK
Oops, that should say 404 not 200! It doesn’t take much to fix it. At the very top of the custom 404 page (before any <doctype> or <html> tag) just add in:
<cfheader statusCode="404" statusText="Not Found">
Checking the Response Header Information again following that change then correctly returns:
Connection: close
Date: Wed, 25 Mar 2009 20:41:30 GMT
Server: Microsoft-IIS/6.0
Content-Type: text/html
Page-Completion-Status: Normal, Normal404 Not Found
and Google then successfully verifies the website.





Hello Duncan,
Thank you so much for your post, this article has helped me to solve http status code problem.
Now, I will read your whole blog it seems more interesting
Comment by Rajesh Mergu — June 17, 2010 @ 3:05 am |
Hi Duncan,
I am using same pattern for our agents custom URLs.
However, they are not appearing in Google search.Even if, I type their custom URLs along with domain.
I submitted their URLs in XML site map too.
Any clues.
Thanks in advance
Comment by Srinivas — August 11, 2010 @ 7:20 pm |
You want your 404 pages to appear in Google search? Or do you mean you’re using a 404 page to handle custom URLs? If the latter, there’s probably a better way to do it. Can you give me more information about how you’re handling your custom URLs?
Comment by duncan — August 12, 2010 @ 1:20 am |
I am using 404 page to handle custom URLs.In addition to that , I want to show up that results in Google search if the user types agent Custom URL along with domain in Google.
404 page code as follows,
SELECT ID
FROM AGENT_PROFILE
WHERE customURL =
#cfcatch.Detail#
#responseResult.fileContent#
Comment by Srinivas — August 12, 2010 @ 7:09 am |
Oops code stripped,give me your mail id.will send you more details.
Comment by Srinivas — August 12, 2010 @ 7:34 am
duncancumming AT gmail DOT com
Comment by duncan — August 12, 2010 @ 8:21 am |
Thank you for your post. I followed your directions, but it only seems to work for files not found of .HTM or .HTML extensions, not .CFM or .CFML extensions. Is there something else to be done to respond on a not found .CFM file?
Comment by Larry Larson — April 10, 2012 @ 7:05 pm |
In the CF Administrator you probably need to update the Missing Template Handler. Read this: http://helpx.adobe.com/coldfusion/kb/coldfusion-mx-configuring-missing-template.html
Comment by duncan — April 11, 2012 @ 9:49 am |