DEV Community

Discussion on: User directories

Collapse
 
dmfay profile image
Dian Fay

I can't help you with the PHP, but yes, there's definitely some way to use the path part of the URL to look something up. However, you may not want it to be the very first path segment, since that means any first path segment could be a username, and you'd have a difficult time adding any other functionality. This is why Reddit (for example) has the /u/ or /user/ prefix in the path: to ensure there's no confusion as to what the thing you're looking up is. DEV goes without the prefix, I assume because all content is user-driven, but at the price of needing to filter out the potential usernames "dashboard", "notifications", "signout_confirm", etc.

There's been a lot of thought devoted over the years to how to organize URLs. Things have more or less settled on what's called RESTful semantics.