diff --git a/static-main.php b/static-main.php index aedbb2bf0..37878feb1 100644 --- a/static-main.php +++ b/static-main.php @@ -1,18 +1,22 @@ cache dir mapping - if (file_exists('../subsites/host-map.php')) { - include_once '../subsites/host-map.php'; - } else { - $subsiteHostmap = array(); - } +if (file_exists('../subsites/host-map.php')) { + include_once '../subsites/host-map.php'; + $siteHostmap['default'] = isset($siteHostmap['default']) ? $siteHostmap['default'] : ''; // Look for the host, and find the cache dir $host = str_replace('www.', '', $_SERVER['HTTP_HOST']); - $cacheDir = isset($siteHostmap[$host]) ? $siteHostmap[$host] : $siteHostmap['default']; + $cacheDir = (isset($siteHostmap[$host]) ? $siteHostmap[$host] : $siteHostmap['default']) . '/'; } else { $cacheDir = ''; } @@ -21,10 +25,10 @@ if ($domainBasedCaching) { $file = preg_replace('/[^a-zA-Z0-9]/si', '_', trim($_SERVER['REQUEST_URI'], '/')); $file = $file ? $file : 'index'; -if (file_exists('../cache/'.$cacheDir.'/'.$file.'.html')) { - echo file_get_contents('../cache/'.$cacheDir.'/'.$file.'.html'); -} elseif (file_exists('../cache/'.$cacheDir.'/'.$file.'.php')) { - include_once '../cache/'.$cacheDir.'/'.$file.'.php'; +if (file_exists('../cache/'.$cacheDir.$file.'.html')) { + echo file_get_contents('../cache/'.$cacheDir.$file.'.html'); +} elseif (file_exists('../cache/'.$cacheDir.$file.'.php')) { + include_once '../cache/'.$cacheDir.$file.'.php'; } else { // No cache hit... fallback!!! include 'main.php';