SEO Friendly Links in PHP
This code removes all special characters from the given URL and make it SEO friendly.
[View All Snippets]
[View All Snippets]
Show Plain Text »
- <?php
- function makeMyUrlFriendly($url){
- $output = preg_replace("/\s+/" , "_" , trim($url));
- $output = preg_replace("/\W+/" , "" , $output);
- $output = preg_replace("/_/" , "-" , $output);
- return strtolower($output);
- }
- ?>