I was thinking about how i should write my URLs. I want them to A) Be user friendly B) SEO C) allow fast DB queries. The information i have are username, category, mediaId, title and other data i dont feel is necessary (date, hash, etc).
Should i have the username before or after the domain name? (username.mysite.com/ vs mysite.com/username/).
Then i need to decide if i should use /media/The-Title-Of-Media or /media/mediaId/The-Title-Of-Media (media being 8 or 16 digit number) or any variants (such as media/The-Title-Of-Media-MediaId).
Do i want a mediaId in there? i was thinking it could speed up the db query but if i am validating it against the username (so mysite.com/deceptiveUserName/media/mediaId/title is not allowed) just using WHERE userid=expectedUserId may be a hairline less efficient then a query using a primary key? Also using a mediaId allows the title to not be unique but would it be a bad idea to allow users to lazily not give everything a unique title? if i allow lazyness users may look at a url before and after and think they are the name due to title. Or it become hard to find a link in a list of links?
-edit-
Hows this. mysite.com/username/media/mediaId/title. If the title happens to change i can update the URL and not break links bc the mediaId is still the same.