SEO friendly links in PHP

Submitted by:David Villa

Date added:02 June, 2012

Category:PHP

This code removes all special characters from the given URL and make it SEO friendly.

Tags: removes special characters , seo friendly links

Code Snippet:

    <?php          
function makeMyUrlFriendly($url){
$output = preg_replace("/\s+/" , "_" , trim($url));
$output = preg_replace("/\W+/" , "" , $output);
$output = preg_replace("/_/" , "-" , $output);
return strtolower($output);
}
?>
 
 

Comments