I would like to know if there's an easier way other than Mod Rewrite (using the fusebox framework or directly in Coldfusion) to convert a url as follows:
from:
http://www.somedomain.com/salmahayek
or
http://localhost/someApp/salmahayek
to:
http://www.somedomain.com/index.cfm?action=profile.view&name=salmahayek
or
http://localhost/someApp/index.cfm?action=profile.view&name=salmahayek
My app is an existing Fusebox 5.5 application.
I just need to add that the url above is not static, i.e. "salmahayek" could be any name.
Any help would be greatly appreciated Thanks
You could potentially use the "classic" way of doing it (not sure if Fusebox will interfere), using a 404 handler, something like this should do the trick:
Set up a 404 hander on your server, e.g. in .htaccess:
ErrorDocument 404 /404handler.cfm
set up 404handler.cfm to wrap around the framework, e.g.:
<cfset variables.checksok = false> <!--- do some checks - example ---> <cfif cgi.REDIRECT_URL EQ 'salmahayek'> <cfset variables.checksok = true> </cfif> <cfif variables.checksok EQ true> <cfheader statuscode="200" statustext="OK"> <cfset url.action = "profile.view"> <cfset url.name = cgi.REDIRECT_URL> <cfinclude template="index.cfm"> </cfif>
(not tested but should work)