I’m talking about slugs, SEO friendly URLs, clean URLs, permalinks, etc. You know, those nice-looking URLs that are easy to read (for humans and search engines). The keywords that show up in your URLs plan an important role in how well your site ranks in search results. That’s one reason why it’s common for blogging systems like WordPress to create permalinks from post titles.

I’ve had a function in my toolbox for doing this sort of thing for a while now. While working on an article management system the other day, though, I decided to take another look at it and polish it up a bit. UTF-8 support was an important feature to me; as well as a flexible set of parameters that’d allow me to easily adapt it to different projects without having to modify the function. This is what I came up with: