Simple Clean URL Function in PHP
When u want to make permalink or clean url in your website, u will need function code that will encode your link to that (except u using CMS
). The example for clean url > from http://www.myweb.com/a=post&b=1 become http://www.myweb.com/post/1 its more beauty and more friendly to search engine. Beside using this function u can using it with .htaccess and some mod_rewrite engine in Apache. U can see in my other article for that
. Lets see my simple code is :
/* clean url */
function permalink($stringurl) {
$url=parse_url($stringurl);
$strurl = basename($url['path'],".php").".";
$qstring = parse_str($url['query'],$vars);
while(list($k,$v) = each($vars)) {
$strurl .= $v.".";
}
$strurl .= "html";
return $strurl;
}
Recent Comments