PHP and dynamic URLs

Twitter Facebook Pinterest Google+ Stumbleupon LinkedIn


Whenever I make a new website now I always think about what the urls will need to be like. Most off the shelf CMS platforms will have a plug in or option to enables similar functionality.  But if your writing the site yourself you will want to be able to convert URL from post Id’s to post names to Urls and back again.

I have used many methods to do this in the past but recently I found two really useful built in PHP functions. urlencode() and urldecode().

Alternatives to using urlencode() would be writing your own function to convert all the url unfriendly symbols, slashes, spaces etc. into HTML entities or just replacing them with hyphens.

Again PHP has an built in function for everyhting.


Posted by Adi on February 3, 2010

Twitter Facebook Pinterest Google+ Stumbleupon LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *