That's what I needed. Many thanks :-) -----Original Message----- From: Bob Haroche [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 10:58 AM To: CF-Talk Subject: Re: Custom 404 pages - catching invalid links
> I'm creating a custom 404 page. I'd like to be able to catch the invalid > links that the users are typing in. > > Such as... > > The page you were trying to get, http://www.mysite.com/foo > <http://www.mysite.com/foo> , was not found. Etc.... Here's what I use for that: <p>The page you requested, <CFOUTPUT><em>#ListLast(cgi.query_string, ";")#</em></CFOUTPUT>, does not exist or has been moved.</p> ---- And here's what I use to set up re-directions for old/moved pages and, if no re-mapping already exists, to send an email alert for pages not found. This code is set up in a separate template and incorporated via <CFINCLUDE> ias the first thing into the custom 404.cfm page. HTH. ------------ <!--- Create re-mappings for old pages/new pages ---> <CFSET Redirects = StructNew()> <CFSET Redirects["/old-page1.cfm"] = "/new-page1.html"> <CFSET Redirects["/old-page2.cfm"] = "/new-page2.html"> <!--- Determine page being requested, stripped of protocol and server data ---> <CFSET pageRequest = "/" & ListRest(ListRest(ListLast(cgi.query_string, ";"), "/"), "/")> <!--- Redirect to new page if mapping exists ---> <CFIF StructKeyExists(Redirects,pageRequest)> <CFHEADER statusCode = "301"> <CFLOCATION url= "http://#cgi.http_host##Redirects[pageRequest]#"> <!--- Elsewise send webmaster a 404 alert ---> <CFELSE> <CFMAIL type="HTML" to="#ErrorEmail#" from="ErrorRobot@#cgi.http_host#" subject="Page Not Found: #ListLast(cgi.query_string, ";")#"> <p>A requested file was not found on the #OrgShort# website</p> <p>-------------------------------------------------------</p> <p>URL Requested: #ListLast(cgi.query_string, ";")#<br> Error Date/Time: #DateFormat(Now(),"MMM D, YYYY")# at #TimeFormat(Now(),"h:mm tt")#<br> Referring Page: <a href="#CGI.HTTP_Referer#">#CGI.HTTP_Referer#</a><br> Browser Used: #CGI.HTTP_USER_AGENT#</p> </CFMAIL> </CFIF> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.