<?php $url = (!empty($_SERVER['HTTPS'])) ? "https://" : "http://"; $url .= $_SERVER["HTTP_HOST"]."?".$_SERVER["QUERY_STRING"]; echo $url; ?>