My First Attempt at Tackling SES
Okay, I have to admit, I'm not sure if people are going to find this as interesting as me, but I'm kind of weird. I love to create dynamic websites, but I've always hated the ugly url's they tend to create. You know what I mean. Let's say you have a product page. In the old days, you could do something as simple as this:
products.cfm?pid=2369
... and your ColdFusion code for the products.cfm would look something like this:
<cfparam name="url.pid" default="0">
<cfquery name="GetProduct" datasource="mydns">
SELECT Category, SubCategory, ProductName, PID
FROM Products
WHERE PID = #url.pid#
</cfquery>
But then, shorty after I learned what a Google was, this simple URL became more like this:
products.cfm?pid=2369=category=accessories&subcategory=gloves&name=Fuzzy+Pink+Mittens
You would use the exact same code above for your ColdFuson page, but the added benefit was that most major search engines understand this URL. They look at it and grab the important keywords out of it, but I started wondering if they prefered a "real" directory structure over URL variables. I'm not 100% sure, but awhile ago I started playing around with something more like this:
products.cfm?id=2369/accessories/gloves/Fuzzy+Pink+Mittens/
You are left to interpet the id and assign it to any page variables yourself. Grab the url.id parameter and then convert it to a list, array or structure by splitting it at the "/" characters. If you take a look at this website, you will notice that's how the URL is structured for the blog articles. The changes to your source code would look something like this:
<cfparam name="url.id" default="">
<cfparam name="url.pid" default="0">
<cfif ListLen(url.pid,"/") gt 0>
<cfset url.pid = ListFirst(url.id,"/")>
</cfif>
<cfquery name="GetProduct" datasource="mydns">
SELECT Category, SubCategory, ProductName, PID
FROM Products
WHERE PID = #url.pid#
</cfquery>
As you can see, all we did with the URL parameter is pass it a list seperated by a "/". And in turn, this is what the search engines use to create a directory structure to your content. In essense, we're fooling them into thinking that the list is actually part of the structure. Give it a try and see if it helps.
Have something to say? Leave a comment!
You don't have to be registered to leave a comment. Unregistered user's comments will be approved before going live.
You are currently posting as an unregistered user.
This means that your comment will be reviewed prior to going live. If you are a registered user, please login. New user? No problem, register for an account, it's FREE! Benefits include, posting instantly, screen name protection, collaboration recognition, subscribe to article updates, and so much more!