How can I convert a given url to a base url? That means if I have "http://test.com/folder/it.html?gsa=5", the script should return "http://test.com/folder/".
I tried:
preg_match('~.*/~', $cur_url, $match);
$base=($match[0]=='http://') ? $cur_url : $match;
Doesn't work good.