Skip to content

ColdFusion Search Engine Safe URLs

After seeing this post on SES URLs from Ray Camden, I noticed that the idea behind it was similar to what I was already using on this blog software. I didn’t think it was all that incredible on it’s own, buy maybe I was wrong. Anyway, here’s the code I’ve been using in my application.cfm file:

<cfset urlstring = cgi.path_info>
<cfloop from=”1″ to=#ListLen(urlstring,”/”)# index=”i”>
<cfif i mod 2>
<cfset paramName = “URL.” & ListGetAt(urlstring,i,”/”)>
<cfelse>
<cfparam name=”#paramName#” default=”#ListGetAt(urlstring,i,”/”)#”>
</cfif>
</cfloop>

This is written for general ColdFusion use, not the Model-Glue environment, so there’s no check for an event variable. It’s not too much different, but I thought I’d go ahead and post it. Feel free to use it for your own purposes, but please give credit where it’s due.

Published incoldfusion

Be First to Comment

Leave a Reply