I want to create shortened links for specific pieces of content on my site. To view these pages now, I pull the relevant content via the content ID passed via GET (ie, mysite.com/content/?id=332). To obfuscate the ID, I want to use base64 to encode and decode it into a short alphanumeric string (like 34sa6), which I already know how to do.
My question is this: does it make more sense to store this string as a database field on creation of each piece of content, or simply decode the string on the fly when a user visits mysite.com/content/34sa6 (which means visiting mysite.com/content/?id=332 will also load the correct page). If I store this instead, it will become the defacto primary key for my purposes, as all related content will be queried based on it, so just trying to figure out the wisest way to do it.