[Coldbox 3.8.1]


My question is not very Coldbox specific I suppose, but I’m using ColdBox and trying to leverage the routes.cfm file.

I had a question around using SEO/Friendly URLS. I wanted to not show the ID in the query string and just show a friendlyURL like the URL below, but how do others pull the content from the database without using the ID (primary key value). Do most just using the friendly URL or is there someway to pass the ID when a user clicks the link, but not have it appear in the URL?

For example, if I have a product category page and in the URL you see: http://somewebsite.com/electronics-category

I know I can obviously have a field in the db and store the friendly url “string” in the database, and just look it up that way, but I don’t like filtering on string values and would rather use an ID value if that makes sense. Over the years, I’ve just had the ID in the URL if it wasn’t sensitive info, or used a UUID or GUID, but is there a way to not show the ID in the URL, but still look it up in the database using the ID?

I hope that makes sense…any help appreciated…

You simply can’t.

Actually I take that back, you can’t using the URL. But if you use RPC calls through Ajax you could, just with the URL you have to have all your information sent across in the URL.

What’s wrong with going to the database with a string value to look up the id? It’s what pretty much every CMS ever does. Just make sure the column has a unique index on it for data integrity and performance.

The only other way to pass data to a page that isn’t part of the URL is as a form field. So, conceivably, each link could submit a little form. I would highly recommend against this though because then people can’t bookmark your site and their browser will flip out if they hit the back button.



ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Just make sure you add an index and it is unique and it will be just as fast as a key lookup.


Roger that, good idea about the unique index…thanks for the replies…