Showing posts with label SEO. Show all posts
Showing posts with label SEO. Show all posts

Monday, April 16, 2012

Making clean string for SEO friendly urls using php

SEO stands for search engine optimization, and it is very important aspect of web business and its success. In order to make a website SEO friendly, we have to take care or many SEO rules. One of which is SEO friendly urls. SEO friendly url should have meaningful keywords so that spider can find the exact content of page.

The function to make clean url is

 private function clean_url($text)  
  {  
       $text=strtolower($text);  
       $code_entities_match = array(' ','--','&quot;','!','@','#','$','%','^','&','*','(',')','_','+','{','}','|',':','"','<','>','?','[',']','\\',';',"'",',','.','/','*','+','~','`','=','"');  
       $code_entities_replace = array('-','-','','','','','','','','','','','','','','','','','','','','','','','','');  
       $text = str_replace($code_entities_match, $code_entities_replace, $text);  
       return $text;  
 }  

took help from http://www.9lessons.info/2011/04/seo-friendly-urls-with-php.html