Searched For : humbug / Main
September 22, 2005
I've always maintained a healthy skepticism about the effectiveness of so-called Search Engine Safe URLs but after a yet another question about how to do SES URLs with framework X, I decided to go ahead and convert my blog (and entire website) to use SES URLs just for kicks.
The code is trivial. My various Application.cfm files simply include /ses.cfm at the top and, for the most part, I simply changed how the myself variable is set in the various fusebox.init.cfm files:
<cfset self = "/index.cfm" />
<cfset selfAction = self & "/" & application.fusebox.fuseactionVariable & "/" />
The /ses.cfm just contains this code: <cfset selfAction = self & "/" & application.fusebox.fuseactionVariable & "/" />
<cfset isArg = true />
<cfloop list="#CGI.PATH_INFO#" index="av" delimiters="/=&">
<cfif isArg>
<cfset argName = av />
<cfelse>
<cfset URL[argName] = av />
</cfif>
<cfset isArg = not isArg />
</cfloop>
Using /=& for delimiters just means that any leftover &arg=value pairs in the URL will be correctly handled. <cfloop list="#CGI.PATH_INFO#" index="av" delimiters="/=&">
<cfif isArg>
<cfset argName = av />
<cfelse>
<cfset URL[argName] = av />
</cfif>
<cfset isArg = not isArg />
</cfloop>
Then I went through my display fuses fixing most (all?) of the old &arg=value URLs.
A minor gotcha: relative file paths don't always work (hence /index.cfm) so I had to fix a few image references etc.
Let me know if you find any broken links as a result of this change.


