Created
May 20, 2012 20:50
-
-
Save apphp-snippets/2759485 to your computer and use it in GitHub Desktop.
This code removes all special characters from the given URL and make it SEO friendly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Source: http://www.apphp.com/index.php?snippet=php-get-remote-ip-address */ | |
function makeMyUrlFriendly($url){ | |
$output = preg_replace("/\s+/" , "_" , trim($url)); | |
$output = preg_replace("/\W+/" , "" , $output); | |
$output = preg_replace("/_/" , "-" , $output); | |
return strtolower($output); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment