Example current URL http://www.domain.com/subdomain/install/finish.php
I use this code to get the current URL.
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
Now I want to get the URL looks like http://www.domain.com/subdomain
if there don't have sub-folder it will read like http://www.domain.com
Let me know.