How can I use ColdFusion to affect the status code returned on a page request?

Posted on 2009-04-24
Last Modified: 2012-05-06
I know this is a little wierd, but I am using my 404 error page to run a content management system. For example, if you go to, there is no page called "AboutUs/index.cfm" or anything like it. So the server goes to the 404 page, which looks at the URL and decides what text to display.

The problem is that I am afraid that while the page looks fine, the header is sending back a 404 which will confuse search engines. For example, cgi.query_string="404;".

I would like to specifically set the http status in my code, so I can send back a 200 if I want to indicate that the page is found (even though there is no real page with that filename), and a 404 if it really is not found. However, I cannot find any response header that will set the status code.

Thanks in advance for any help.

Also, if you are the kind of person who can help with this, you may also be able to help on a related question that I am posting simultaneously, where I am trying to send back header data that will include the (faked) resource location.
Question by:DataCollab
    LVL 51

    Accepted Solution

    Have you tried using cfheader to set the status code returned?

    <cfheader statuscode="xxx" statustext="Status text here" />

    Author Closing Comment

    That did it!

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them ( . I did keep the main js functions but made sever…
    A few customers have recently asked my thoughts on Password Managers.  As Security is a big part of our industry I was initially very hesitant and sceptical about giving a program all of my secret passwords.  But as I was getting asked about them mo…
    This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
    This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now