Using ColdFusion to set CGI variables

Posted on 2009-04-24
Last Modified: 2013-12-25
I would like my 404 error page (which is actually running my content management system) to set the CGI variables that get returned to the client.

For example, if you go to, there is no real products page, so the server goes to the 404 page (template_a.cfm), which looks at the URL and creates the correct page on the fly.

However, some of the cgi variables still return the name of the 404 page, instead of "Products" - I am concerned that this will cause Search Engines to not index "Products" or any of my other pages either.

If you go to, you can see a dump of the CGI structure, and you will see "template_a.cfm" prominently mentioned.

So I have two questions. First, do those CGI variables normally get returned to the client, and if so, are they going to confuse search engines? (that was actually one question)

Second, if this is a problem, is there a way I can set those CGI variables? I tried doing a cfset, and that did not work (no surprise). I also tried something like this:
      <cfheader name="Content-Location" value="Products">
and that did not work either.

Thanks for any help.
Question by:DataCollab
    LVL 16

    Accepted Solution

    AFAIK, search engines aren't checking your CGI variables for information to index.  Although some CGI variables feature the name of your .cfm page, no user is going to know that, unless they're in the habit of inspecting page header information.  If the information is secret, then this is no good, but if you're just concerned they'll confuse the page names, then that shouldn't be a problem, assuming you can set your <title></title> to whatever you intend it to be.

    On another note, if this is meant to be a 404 page, it shouldn't return the response header of 200.  Which it does currently.  You should return the correct 404 response header.

    Check this article or basically just put this at the very top (for genuine 404 messages)
    <cfheader statusCode="404" statusText="Not Found">


    Author Closing Comment

    Thanks very much.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    [Part 2 of a 6 part series called SEO Basics: 5 SEO Secrets for Creating Content that Drives Traffic (…
    Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    728 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

    18 Experts available now in Live!

    Get 1:1 Help Now