Get the full URL in PHP -
i use code full url:
$actual_link = 'http://'.$_server['http_host'].$_server['php_self'];
the problem use masks in .htaccess
, see in url not real path of file.
what need url, written in url, nothing more , nothing less—the full url.
i need how appears in navigation bar in web browser, , not real path of file on server.
have @ $_server['request_uri']
, i.e.
$actual_link = "http://$_server[http_host]$_server[request_uri]";
(note double quoted string syntax perfectly correct)
if want support both http , https, can use
$actual_link = (isset($_server['https']) ? "https" : "http") . "://$_server[http_host]$_server[request_uri]";
editor's note: using code has security implications. client can set http_host , request_uri arbitrary value wants.
Comments
Post a Comment