Coldfusion dynamic friendly Urls


I am looking for some advice with regards to creating dynamic seo friendly urls for a ecommerce store I am producing for a client.
I would normally go down the standard route of using url id's to select the relevant data from the database so my urls would have the familiar

I now have the need to be able to turn the above url into something like the following for example (menswear being the product group and trousers and shorts being the subgroup.

Can anyone suggest a 100% fullproof way of achieving this with Coldfusion that does not include having to use descriptions as Id's in the database. I have seen this used and it is very messy when descriptions change.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Joshua TitsworthConnect With a Mentor Digital Marketing SpecialistCommented:
I found this code:

   // search engine friendly urls for SSO and SEO
   if (cgi.query_string IS NOT "") {
   gotoURL = "#cgi.script_name#?#cgi.query_string#";
   else {
      if (cgi.script_name EQ cgi.path_info){
      gotoURL = cgi.script_name;
      else {
      gotoURL = cgi.script_name & cgi.path_info;
   // translate path
   pathInfo = reReplaceNoCase(trim(cgi.path_info), '.+\.cfm/? *', '');
   i = 1;
   lastKey = "";
   value = "";
   if(not len(pathInfo)) break;
   for(i=1; i lte listLen(pathInfo, "/"); i=i+1) {
   value = listGetAt(pathInfo, i, "/");
   if(i mod 2 is 0) url[lastKey] = value;
   else lastKey = value;

Posted on this link:

Hope it helps.
You might want to look at using something like Isapi Rewrite if on IIS or mod_rewrite if on Apache
This custom tag works well for SEO URLs

 It has been implemented on this web site ...

(just click to view any product)

 I checked with the developer of this site, no changes were made to IIS to get this to work.
All Courses

From novice to tech pro — start learning today.