I have created a site that uses mod_rewrite to create friendly URL's. I now need to be able to grab the URL that the user is on without having to fully rebuild it from the passed variables. I tried to use
$host = $_SERVER['HTTP_HOST'];
$self = $_SERVER['PHP_SELF'];
$query = !empty($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
$url = !empty($query) ? "http://$host$self?$query" : "http://$host$self";
echo $url;
but this returns a url that looks like
http://domainname.com/browse.php?type=restaurants§ion=cajun
which the correct url for this page is
http://domainname.com/events/restaurants/cajun/
Does anyone know how I can grab this URL?