SEO friendly links in PHP


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. <?php
  2. function makeMyUrlFriendly($url){
  3. $output = preg_replace("/\s+/" , "_" , trim($url));
  4. $output = preg_replace("/\W+/" , "" , $output);
  5. $output = preg_replace("/_/" , "-" , $output);
  6. return strtolower($output);
  7. }
  8. ?>

URL: http://www.apphp.com/index.php?snippet=php-seo-friendly-links

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.