News

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

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( '/[Versi cetak





Direkomendasikan


Jasa pembuatan aplikasi web berbasis PHP dan MySQL, Web Portal, Personal, Toko Online, Sistem Informasi Akademik, SIMPeg dan Rumah Sakit, Aplikasi Facebook, dan lain sebagainya termasuk penyedia domain dan hosting unlimited murah. Telp. dan WA 08175499076.