Create a URL from a string of text with PHP and mod_rewrite

24 November 2011

Quite often when developing big web apps you may need to use mod_rewrite to generate SEO friendly URLs from a string of text, Very similar to the way Word press generates URLs for blog posts.

The Code

Below is the function which will remove all the spaces and special characters from a string and convert it to lowercase making sure its formated ready to be used as a page URL.

function create_slug($string){
   $string = preg_replace( '/[
Sumber : Jasa Pembuatan Website dan Sistem Informasi
Selengkapnya :