summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2014-01-26 15:24:05 -0800
committerGreg Roach <fisharebest@gmail.com>2014-01-26 15:24:05 -0800
commit73bfe2c594380314ae38dcf3ad82de03cb7477ae (patch)
treeca70b5b809ba448d0690ecf5b019e10591847ec6
parentafbd910722cc479ccf653e37d2bc035460beb146 (diff)
parent426e70bbd79af6979ff3d520885305939b0cb52e (diff)
downloadwebtrees-73bfe2c594380314ae38dcf3ad82de03cb7477ae.tar.gz
webtrees-73bfe2c594380314ae38dcf3ad82de03cb7477ae.tar.bz2
webtrees-73bfe2c594380314ae38dcf3ad82de03cb7477ae.zip
Merge pull request #63 from IJMacD/redirected_script_url
Fixed redirection bug
-rwxr-xr-xincludes/session.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/includes/session.php b/includes/session.php
index 6fc49ea114..d3f42ff1ef 100755
--- a/includes/session.php
+++ b/includes/session.php
@@ -172,9 +172,12 @@ define('WT_SERVER_NAME',
(empty($_SERVER['SERVER_PORT']) || (!$https && $_SERVER['SERVER_PORT']==80) || ($https && $_SERVER['SERVER_PORT']==443) ? '' : ':'.$_SERVER['SERVER_PORT'])
);
+// REDIRECT_URL should be set in the case of Apache following a RedirectRule
// SCRIPT_NAME should always be correct, but is not always present.
// PHP_SELF should always be present, but may have trailing path: /path/to/script.php/FOO/BAR
-if (!empty($_SERVER['SCRIPT_NAME'])) {
+if (!empty($_SERVER['REDIRECT_URL'])) {
+ define('WT_SCRIPT_PATH', substr($_SERVER['REDIRECT_URL'], 0, stripos($_SERVER['REDIRECT_URL'], WT_SCRIPT_NAME)));
+} elseif (!empty($_SERVER['SCRIPT_NAME'])) {
define('WT_SCRIPT_PATH', substr($_SERVER['SCRIPT_NAME'], 0, stripos($_SERVER['SCRIPT_NAME'], WT_SCRIPT_NAME)));
} elseif (!empty($_SERVER['PHP_SELF'])) {
define('WT_SCRIPT_PATH', substr($_SERVER['PHP_SELF'], 0, stripos($_SERVER['PHP_SELF'], WT_SCRIPT_NAME)));