Skip to content

Commit

Permalink
Fix webSiteRootURL if Apache Alias directive is used
Browse files Browse the repository at this point in the history
When Apache Alias directive is used to map AVideo installation on
a given URL prefix, webSiteRootURL should be derived from the
CONTEXT_PREFIX environment variable

superseeds
WWBN#9884
WWBN#9883
  • Loading branch information
manu0401 committed Feb 15, 2025
1 parent 6caf099 commit c0b7166
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions install/checkConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,14 @@
\$global['disableTimeFix'] = 0;
\$global['logfile'] = '{$_POST['systemRootPath']}videos/avideo.log';
if(!empty(\$_SERVER['SERVER_NAME']) && \$_SERVER['SERVER_NAME']!=='localhost' && !filter_var(\$_SERVER['SERVER_NAME'], FILTER_VALIDATE_IP)) {
// get the subdirectory, if exists
\$file = str_replace(\"\\\\\", \"/\", __FILE__);
\$subDir = str_replace(array(\$_SERVER[\"DOCUMENT_ROOT\"], 'videos/configuration.php'), array('',''), \$file);
// get the subdirectory, through CONTEXT_PREFIX if Apache Alias
// directive is used, or from DOCUMENT_ROOT otherwise
if (!empty(\$_SERVER['CONTEXT_PREFIX'])) {
\$subDir = \$_SERVER['CONTEXT_PREFIX'];
} else {
\$file = str_replace(\"\\\\\", \"/\", __FILE__);
\$subDir = str_replace(array(\$_SERVER[\"DOCUMENT_ROOT\"], 'videos/configuration.php'), array('',''), \$file);
}
\$global['webSiteRootURL'] = \"http\".(!empty(\$_SERVER['HTTPS'])?\"s\":\"\").\"://\".\$_SERVER['SERVER_NAME'].\$subDir;
}else{
\$global['webSiteRootURL'] = '{$_POST['webSiteRootURL']}';
Expand Down

0 comments on commit c0b7166

Please sign in to comment.