Changed CGI.REQUEST_URI behaviour with CF7/Apache - A Solution

Those who have upgraded their Apache 2 CF servers to CF7 may have noticed that CGI.REQUEST_URI no longer contains the original request URL and query string when Apache does a 404 redirect to a CF page. For example, we just found this the hard way. In 6.1, the var would contain the original URL and the query string - it now contains the 404's URL and no query string info.

Well, there are other CGI vars available that do the trick: CGI.REDIRECT_URL and CGI.REDIRECT_QUERY_STRING. These contain all the original info on the request so you can get back to the way things worked before the upgrade.

http://httpd.apache.org/docs/2.0/custom-error.html

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Chris's Gravatar Thanks! This tip saved me much aggravation. (Luckily in code that is not yet on my production server, just experiments in development.) It's unfortunate that these variables are hidden from both cfdump of the cgi scope and asking for a structKeyList of cgi variables.
# Posted By Chris | 11/8/06 10:53 AM
Brett's Gravatar How long have I been looking for this!!!

Many thanks!

B)
# Posted By Brett | 7/12/07 8:58 PM
Aidan Whitehall's Gravatar You are a time-saver... thanks!
# Posted By Aidan Whitehall | 10/10/08 3:52 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.5.1.