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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -