Flexible Developments

Musings of a freelance PHP, Django and Flex Developer

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 :

  1. You’ll need to edit the necessary path and url info found inside index.php and .htaccess
  2. 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).
  3. 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
  4. 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.

4 Responses to “Search Engine Friendly URLs using PHP”

  1. [...] post: Search Engine Friendly URLs using PHP Related ArticlesBookmarksTags PHP PHP is a computer scripting language. Originally [...]

  2. Trackback said

    Public Post…

    Su Articulo: [2012192] ha sido indexado
    RSS Search Engine.
    From Colombia…

  3. 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

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>