getting the current page full URL
#1
Posted 16 November 2007 - 04:57 PM
#2
Posted 16 November 2007 - 05:38 PM
<?
$_SERVER['FULL_URL'] = 'http';
if($_SERVER['HTTPS']=='on'){$_SERVER['FULL_URL'] .= 's';}
$_SERVER['FULL_URL'] .= '://';
if($_SERVER['SERVER_PORT']!='80') $_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME'];
else
$_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
if($_SERVER['QUERY_STRING']>' '){$_SERVER['FULL_URL'] .= '?'.$_SERVER['QUERY_STRING'];}
?>return $_SERVER['FULL_URL']; will give the query string used in the browser It may have to be decoded.
Yeah I know... I'm bored.
Edited by Cris D., 16 November 2007 - 05:48 PM.
#3
Posted 16 November 2007 - 05:41 PM
#4
Posted 16 November 2007 - 08:39 PM
Ralph, your suggestions will give me what etomite thinks the url for the page ought to be, not what was actually used, complete with any query parameters or anchor specifications. The format I use for my site for the expected base url is [(www_base_path)][~[*alias*]~] which I think also caters for friendly URL prefixes (not that I use one).
Thinking about it further, what I really really want is the url before going through the .htaccess rules, but I don't think thats likely to be available.
#5
Posted 17 November 2007 - 03:46 PM
There is a way to get the entire URL that was used to call the current page... $_SERVER["HTTP_REFERER"] will give the entire URL of the referer... $_SERVER["REQUEST_URI"] can be used to get everything beyond the actual server itself, similar to /manager/index.php?a=200... This could be used with $_SERVER["HTTP_HOST"], whcih would return something like dahlgren.slyip.com...Thinking about it further, what I really really want is the url before going through the .htaccess rules, but I don't think thats likely to be available.
Combining any of these with [(server_protocol)], which returns either http[/] or https gives pretty complete flexibility... I gathered thses settings by snooping around in Etomite manager > View system info > Server Information > View and [b]Etomite manager > Etomite configuration > Site settings and checking the available Etoimite system tags...
Not sure if this helps, but someone may find the information helpful...
#6
Posted 17 November 2007 - 05:56 PM
#7
Posted 17 November 2007 - 09:38 PM
The format I use for my site for the expected base url is [(www_base_path)][~[*alias*]~] which I think also caters for friendly URL prefixes (not that I use one).
Shouldn't that be [(www_base_path)][~[*id*]~] ? That'd generate the correct url depending on the configuration....
#8
Posted 18 November 2007 - 12:08 AM
probably, but I always use an aliasShouldn't that be [(www_base_path)][~[*id*]~] ? That'd generate the correct url depending on the configuration....
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











