[Tip of the Week] Using Rewrites to Clean Up Your URLs

The typical ColdBox application always has “index.cfm” somewhere in each URL. This is required so the web server knows to have your CFML application server process the request. With the SES intereceptor you can eliminate the query string, but do you wonder how some websites get away with no file at all for super pretty URLs like:

This can be accomplished with a rewriting engine in your web server that adds the “index.cfm” back in to the URL once it reaches the server. You can set it up with IIS or Apache. Sound hard? Not if you downloaded the ColdBox bundle! Look in the “/install/SES Rewrite Rules” directory and we have sample rewrite configurations in there to get you started.

More Info: http://wiki.coldbox.org/wiki/URLMappings.cfm

P.S. Remember to remove the index.cfm in your setBaseURL() in routes.cfm so event.buildLink() doesn’t put it back in your links.



ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com