// Get the current URL $currentURL = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo $currentURL;
$_SERVER['REQUEST_URI'] | $_SERVER['HTTP_HOST'] |
---|---|
Retrieves the URI of the current request, including the path and query string | Retrieves the hostname portion of the current URL |
Does not include the protocol or domain | Does not include the path or query string |