Activity Stream
701 MEMBERS
2722 ONLINE
Subscribe to our Newsletter BlackHatKings On Twitter BlackHatKings On Facebook BlackHatKings On Google+
Results 1 to 2 of 2
  1.     
    #1
    Kevin's Avatar



    Website's:
    BlackHatKings.com

    SEO url string filter Using PHP

    This function will transform any string to an seo url like string. It suports latin, french and german special characters.

    Example: applying the function to "Exemplo de aplicação da função" returns "exemplo-de-aplicacao-da-funcao"


    PHP Code: 
        <?php
         
            
    function seoUrl($str){
                
    /** by Jonatas Urias B Teixeira    **/
                
    $a = array('/(à|á|â|ã|ä|å|æ)/','/(è|é|ê|ë)/','/(ì|í|î|ï)/','/(ð|ò|ó|ô|õ|ö|ø|œ)/','/(ù|ú|û|ü)/','/ç/','/þ/','/ñ/','/ß/','/(ý|ÿ)/','/(=|\+|\/|\\\|\.|\'|\_|\\n| |\(|\))/','/[^a-z0-9_ -]/s','/-{2,}/s');
                
    $b = array('a','e','i','o','u','c','d','n','ss','y','-','','-');
                return 
    trim(preg_replace($a$bstrtolower($str)),'-');
            }
         
        
    ?>
    Kevin Reviewed by Kevin on . SEO url string filter Using PHP This function will transform any string to an seo url like string. It suports latin, french and german special characters. Example: applying the function to "Exemplo de aplicação da função" returns "exemplo-de-aplicacao-da-funcao" <?php function seoUrl($str){ /** by Jonatas Urias B Teixeira **/ $a = array('/(à|á|â|ã|ä|å|æ)/','/(è|é|ê|ë)/','/(ì|í|î|ï)/','/(ð|ò|ó|ô|õ|ö|ø|œ)/','/(ù|ú|û|ü)/','/ç/','/þ/','/ñ/','/ß/','/(ý|ÿ)/','/(=|\+|\/|\\\|\.|\'|\_|\\n| Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Kevin's Avatar



    Website's:
    BlackHatKings.com
    You can also try below method

    The following function will return a SEO friendly URL using a supplied string.

    PHP Code: 
        <?php
         
        
    function seo($string){
          
    $string preg_replace("`\[.*\]`U","",$string);
          
    $string preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$string);
          
    $string preg_replace"`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1"$string );
          
    $string preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-"$string);
          
    $string htmlentities($stringENT_COMPAT'utf-8');return strtolower(trim($string'-'));
        }
         
        
    ?>

  4. The Following 1 Users Say Thank You to Kevin For This Useful Post:
    [ Click to Expand ]

    BHK (21st Sep 2015)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

User Tag List

Tags for this Thread

BE SOCIAL