Welcome Guest, Not a member yet? Register   Sign In
isset($_SERVER['HTTPS'])
#1

[eluser]theshiftexchange[/eluser]
Hi everyone,

I've recently started using the piece of code below to define my base url:

Code:
$config['base_url'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 'https://' : 'http://' ;
$config['base_url'] .= $_SERVER['HTTP_HOST'];
$config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/';

My question is: where is $_SERVER['HTTPS'] defined?
#2

[eluser]tonanbarbarian[/eluser]
as the name suggests all $_SERVER variables are provided by the webserver
#3

[eluser]Shay Falador[/eluser]
The whole $_SERVER global-array is defined by PHP itself.
The HTTPS is defined and contains on if the page is accessed by https protocol (e.g. https://www.domain.com/ will set it on, http://www.domain.com/ won't).
You can read more about $_SERVER global-array in php.net web site.




Theme © iAndrew 2016 - Forum software by © MyBB