Coldfusion dynamic friendly Urls

Hi,

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 http://www.myshop.co.uk/viewproducts.cfm?ProdGroup=12&subgroup=1034

I now have the need to be able to turn the above url into something like the following for example
http://www.myshop.co.uk/menswear/trousers-shorts.cfm (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.

Thanks
LmillardAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

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

<cfscript>
   // 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;
   }
   break;
</cfscript>

Posted on this link:
http://forums.crystaltech.com/index.php?topic=34030.0

Hope it helps.
0
 
duncancummingCommented:
You might want to look at using something like Isapi Rewrite if on IIS or mod_rewrite if on Apache
http://www.helicontech.com/isapi_rewrite/
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
0
 
gdemariaCommented:
This custom tag works well for SEO URLs
 
   http://developer.fusium.com/tools/ses.cfm

 It has been implemented on this web site ...

   http://www.smarterpos.com/

(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.
0
All Courses

From novice to tech pro — start learning today.