?
Solved

Coldfusion dynamic friendly Urls

Posted on 2010-01-09
3
Medium Priority
?
956 Views
Last Modified: 2013-12-24
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
0
Comment
Question by:Lmillard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Accepted Solution

by:
Joshua Titsworth earned 2000 total points
ID: 26275620
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
 
LVL 16

Expert Comment

by:duncancumming
ID: 26276667
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
 
LVL 39

Expert Comment

by:gdemaria
ID: 26293633
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

Featured Post

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Google always has something new and amazing up its sleeve, and the most current thing that they have been working on is another step in the evolution of Google Search, from machine learning to its brilliant successor, deep learning.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question