OK, thanks James, that was the shove in the right direction that I
needed.  In case anyone else is looking for the same answer, here's my
test code that works:

<cfscript>
        qryRedirect = queryNew("oldurl,newurl","varchar,varchar");
        tmp = queryAddRow(qryRedirect);
        tmp = 
querySetCell(qryRedirect,"oldurl","http://localhost/test/404/nothere.html";);
        tmp = 
querySetCell(qryRedirect,"newurl","http://localhost/test/404/goodurl.cfm";);
        attemptedURL = "http://"; & CGI.server_name & CGI.script_name;
        generatedURL = getToken(CGI.query_string, 2, ";");
</cfscript>
<cfquery name="checkURL" dbtype="query">
        SELECT  newurl
        FROM    qryRedirect
        WHERE   oldurl = '#generatedURL#'
</cfquery>
<cfif checkURL.recordcount EQ 1>
        <cfheader name="Location" value="#checkurl.newurl#">
        <cfheader statuscode="301" statustext="Moved Permanently">
<cfelse>
        <cflocation url="/404.cfm">
</cfif>

Ultimately I will have the redirects in a database which I will load
into memory (via the application scope) for faster access.  Memory
usage won't be an issue, there's only 100 or so URL's to redirect.  If
anyone sees any issues with this code, please let me know.

Thanks,

Pete

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:248391
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to