Search Engine Friendly URLs using PHP
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.