Traditional Search Engine Safe URLs

First, the basic URL. You may decide which separator to use for the name/value pairs. We have the default set to use a "/", meaning you cannot pass any empty values. Some people prefer to use : or - which will allow you to pass names with no values. This may be set in the file named ses_url.cfm in the ezcart folder. The variable to change is request.ses_namevalueseparator on line 1.

On line 2 you will see our little trick. It is a variable named "ses_". We figured there was little chance this variable name would be in use by anything else, but you may change it if you like. Here's how it works.

There are 6 variables we will always use to check which page we're loading and what items to show. These are also the variables we set in the search engine safe files.

  1. page - Used to tell us what shopping cart page or other content to load. Page values concerning us here are:
  2. action - Used to tell the cart what to do when on the page values shown above. Possible action values include:
  3. man - The Manufacturer ID. Blank if not using manufacturers.
  4. cat - The Main Category ID. Blank for all.
  5. criteria - The Category/Sub Category ID. "0" to show all. Don't pass this value blank if trying to show products.
  6. product_id - The product_id when page=details.cfm.
So, rather than pass a link that looks like this:
http://www.abc.com/page/c/action/list/cat/20/criteria/10/
We can shorten it a little like this:
http://www.abc.com/ses_/c,list,x,20,10,x/
What we do when we find ses_ as the name part of our name/value pair is parse the value part as a comma delimited list, setting each of our variables (page, action, etc.) to the corresponding item in the list. The items must always be listed in the order above, 1 thru 6.

Looking closely, you'll see that we did not pass "man" in the first example because we want to show all manufacturers. We can't pass a blank value for man (as in /action/list/man//cat/20/) because we're using a "/" for our name/value separator. We also didn't pass product_id just because it isn't needed here. Since ColdFusion does not recognize empty values in a list, we have to fill it in with something when passing our ses_ value. If we didn't, ColdFusion would read 20 (the value of cat) as the 3rd item in the list as set man to that value. Instead we use a x. You'll see a x in list elements 3 (man) and 6 (product_id) of our list (c,list,x,20,10,x). This tells our template to set the values of man and product_id to empty values.

So, always pass a 6 item list, using x's for empty values.

Lastly, in addition to cutting down on some of the "junk" in the URL, this "ses_" variable also tells the template we use to parse the search engine safe name/value pairs (ses_url.cfm) to STOP parsing. This allows us to append keyword information to the rest of the URL. We use the manufacturer names, category names, etc., for this in our product map and any other areas where we use this copnvention. So for example, back to our example at Avon, our search engine safe URL would look something like this, with what will appear to search engines to be usable directory names:
http://www.yoursite.com/ses_/c,list,2,20,10,x/Avon Products/Beauty Products/Lip Makeup/
The names will be URL encoded Avon%20Products to the sight, but search engines will read them beautifully.

Remember, since we stop parsing the URL after hitting ses_, if you use this in your own URLs, be sure to add any of your own name/value pairs BEFORE the ses_ variable or they will be ignored.