Search Engine Friendly URLs using PHP
Posted by calisza on December 11, 2008
A little while ago I wrote a post on Django Inspired SEF urls. I’ve since put together a working example and am now making it available for download.
There are a couple of things to note :
- You’ll need to edit the necessary path and url info found inside index.php and .htaccess
- The sample code inside index.php is for demonstration purposes only – I strongly recommend using a proper gateway/bootstrap interface typically found in MVC based systems such as Zend Framework and CakePHP (though they of course have their own SEF url implementations).
- Edit urls.php to play around with the regular expressions. I’ll be the first to admit that my regexp skills are not the best in the world, so if you notice something that will work better, please let me know – I’d really appreciate it
- I’ve included a url generator inside the class to try and make your life easier – view index.php for example usage
That should do it. You can download the script here.
Please play around with it and if you make any improvements I’d love to hear about it.

Search Engine Friendly URLs using PHP | PHP-Blog.com said
[...] post: Search Engine Friendly URLs using PHP Related ArticlesBookmarksTags PHP PHP is a computer scripting language. Originally [...]
Trackback said
Public Post…
Su Articulo: [2012192] ha sido indexado
RSS Search Engine.
From Colombia…
Eneza said
GEEZ!! Thanks for this… It really works! but I wonder if I want it on the index in the public_html how can I put it on the path both in .htaccess and on the index.php
calisza said
Hi Eneza, glad you found a use for the script.
I’m not 100% sure what you’re trying to do, could you perhaps give an example ?