function rewritelink($link){
$link = str_replace('.php','', $link);
$pattern = "/\?[^=]*=/";
$replacement = '/';
$link = preg_replace($pattern, $replacement, $link);
$pattern = "/\&[^=]*=/";
$replacement = '/';
$link = preg_replace($pattern, $replacement, $link);
return $link;
}