Results 1 to 2 of 2
Hybrid View
-
19th Sep 2015, 05:48 PM #1
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($string, ENT_COMPAT, 'utf-8');return strtolower(trim($string, '-'));
}
?>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
-
The Following 1 Users Say Thank You to Kevin For This Useful Post:
- [ Click to Expand ]
-
BHK (21st Sep 2015)
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 2 users browsing this thread. (0 members and 2 guests)
Vn5socks.net 12-09-2024 | socks 5...
Live | 212.83.143.211:26297 | Germany | Frankfurt...