Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
jmoshier #1
404 error and cgi variables
Hello all,
We have a custom 404 error page that our provider has set the link to through
the IIS.
We have set the page email us using cfmail when the page is hit.
In the email we are using cgi variables to get the informaton needed.
My question is: Is there a way to grab the information of the page they were
trying to get to? I can see where they came from but that does not tell me what
page may be possibly having a problem.
Thanks for your help in advance.
jmoshier
<cfmail to="webmaster@domain.com"
from="webmaster@domain.com" subject="ERI - 404 Error Occured" type="html">
A user has encounted a 404 error. Details about the error are listed below:
<br><br>
<strong>Page User Coming From:</strong> #cgi.HTTP_REFERER#<br>
<strong>HTTP User Agent:</strong> #cgi.HTTP_USER_AGENT#<br>
<strong>Remote Address:</strong> #cgi.REMOTE_ADDR#<br>
</cfmail>
jmoshier Guest
-
Client Variables Error
Can someone advise action to take for: "Operation failed on the data source named "CliVars". Reason of failure "Invalid precision value " We are... -
[PHP] URL variables parsing error?
Hi, hiaer@azrael.sk wrote: Try this: <?php echo "var1: {$_GET}"; echo "var2: {$_GET}"; -
URL variables parsing error?
Hi all, I use RedHat9.0 with Apache 2.0.40 & PHP 4.2.2 and I have problem with parsing URL variables... I use this URL:... -
A bug with class variables and using it as an error handler?
Paul Liversidge wrote: You should declare your variables in the class, but only initialise them in the constructor. This was a change in PHP4.... -
Session Variables Error
I am trying to use Session Variables but am receiving the following error. System.Web.HttpException: Session state can only be used when... -
sdwebguy99 #2
Re: 404 error and cgi variables
As an aside, make sure you are not emailing for EVERY 404 error--missing images will also trigger this script. In a year from now when your site goes through a redesign, you will regret it. :-)
sdwebguy99 Guest
-
MikerRoo #3
Re: 404 error and cgi variables
cgi.SCRIPT_NAME contains the page they were requesting.
cgi.QUERY_STRING contains any url parameters.
(Standard and Apache syntax -- may be different on IIS)
Cheers,
-- MikeR
MikerRoo Guest
-
jmoshier #4
Re: 404 error and cgi variables
MikeR,
I tried to use the script name variable and all it gives me is the name of my
404 page. Not the actual URL they were trying to get to.
Could this be because it is IIS?
Thanks for the help
jmoshier
jmoshier Guest
-
MikerRoo #5
Re: 404 error and cgi variables
Yes. IIS must be doing some kind of internal redirect.
IIS may set a non-standard variable that has the information you need.
Put <CFDUMP var="#cgi#"> in your code and you might get lucky and see
something.
Barring that: use CF, not IIS, for 404 errors on CF files.
In CF administrator, check "Enable HTTP status codes".
Then specify your 404 handling template in the "Missing Template Handler".
CGI.Script_Name DOES work properly in a file triggered this way.
Good luck,
-- MikeR
MikerRoo Guest
-
jmoshier #6
Re: 404 error and cgi variables
Mike,
Thanks for the information. Unfortunately we can't specify a Missing Template
in the CF admininstrator. We are on a shared server.
Do you possibly know of another way to get the URL the user was trying to
reach?
Thanks,
jmoshier
jmoshier Guest
-
MikerRoo #7
Re: 404 error and cgi variables
Sounds like the real problem here is your provider. Maybe it's time to
pressure them or to switch?
Anyway, i can only think of one other way to get this info. That's to have
your template open and parse the log files. Your provider has probably
blocked this method too. And, anyway, I don't recommend it.
MikerRoo Guest
-
MikerRoo #8
Re: 404 error and cgi variables
Just thought of another method that may or may not work...
Create an Application.cfm or Application.cfc file that sits at the root of
your web folder -- or add the add the following capability to all existing
Application.cxx files:
The CGI variables work correctly in the Application.cxx files. Copy each
request into a session variable. Hopefully, when your existing 404 page is
triggered, the session variable will be available and you can see the last
requested page.
Good luck,
-- MikeR
MikerRoo Guest
-
Unregistered #9
404 error and cgi variables
For Apache/Linux:
Apply something like my code below on the handler page:
<cfset the404 = cgi.REDIRECT_URL>
<cfif the404 CONTAINS ".php">
<cfset theFileName = listLen(the404,'/')>
<cfset theFileName = listGetAt(the404,theFileName,'/')>
<cflocation addtoken="no" url="/some_directory/#replaceNoCase(theFileName,'.php','.cfm')#">
</cfif>Unregistered Guest



Reply With Quote

