I'm considering my options to implement pretty links for a new website.
I understand how to make the basics work, for example doing:
/view/postTitle/7895
I can just pick up the id 7895 and just ignore the title.
However, I see that some websites manage to get rid of ids altogether:
/view/postTitle
How does this work?
The only way I can think of is that at every request, the pageTitle is sent as a string and some code does some SQL checking to return the correct id. However that would mean a lot of potentially expensive SQL queries no? Especially when you have a lot of posts.
Also, it means that every time someone creates a post, I need to generate a unique, url-friendly, string for that post. I need to check against the database until i get a unique one. That all seems like too much no??
Am I looking at this wrong way? Or are there ready APIs and tools to make this easier and more efficient?
I'm using PHP / MySQL, Apache.
Thanks