From b3a36688d1b197b8ddd9dd7d8be6104afe9c1e49 Mon Sep 17 00:00:00 2001 From: phf Date: Sat, 4 Jun 2016 14:31:53 +0200 Subject: [PATCH] Fix #2666 --- htdocs/filefunc.inc.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b97721f2108..92a41209ba4 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -89,7 +89,18 @@ if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not do { // Note: If calling page was not into htdocs (index.php, ...), then this redirect will fails. // There is no real solution, because the only way to know the apache url relative path is to have into conf file. - header("Location: install/index.php"); + $TDir = explode('/', $_SERVER['PHP_SELF']); + $path = ''; + $i = count($TDir); + while ($i--) + { + if (empty($TDir[$i]) || $TDir[$i] == 'htdocs') break; + if (substr($TDir[$i], -4, 4) == '.php') continue; + + $path .= '../'; + } + + header("Location: ".$path."install/index.php"); exit; }