Regular expression to remove the file name from the SERVER vairables

$sScriptPath = preg_replace("@/(\w){1,}.php(\w)?$@","",$_SERVER['SCRIPT_NAME']);
$sActionPage = "https://".$_SERVER['HTTP_HOST'].$sScriptPath."/member.php?action=add"