Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Apache 2’s CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT Variables
$path = __FILE__;
$url = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on' ?
'http://' :
'https://'
) .
$_SERVER['SERVER_NAME'] .
$_SERVER['CONTEXT_PREFIX'] .
str_replace(
$_SERVER['CONTEXT_DOCUMENT_ROOT'],
'',
$path
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment