• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 758
  • Last Modified:

Using ColdFusion to set CGI variables

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 http://www.datacollaborative.com/Products, 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 http://www.datacollaborative.com/test2, 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.
1 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">

DataCollabAuthor Commented:
Thanks very much.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now