diff --git a/src/_h5ai/backend/php/core/class-context.php b/src/_h5ai/backend/php/core/class-context.php index afddd945..e3ccaf71 100644 --- a/src/_h5ai/backend/php/core/class-context.php +++ b/src/_h5ai/backend/php/core/class-context.php @@ -72,7 +72,7 @@ class Context { public function is_info_request() { - return $this->get_current_path() === $this->setup->get('APP_PATH') . '/public'; + return Util::starts_with($this->setup->get('REQUEST_HREF') . '/', $this->setup->get('APP_HREF')); } public function to_href($path, $trailing_slash = true) { @@ -166,7 +166,7 @@ class Context { public function get_current_path() { - $current_href = Util::normalize_path(parse_url($this->setup->get('REQUEST_URI'), PHP_URL_PATH), true); + $current_href = Util::normalize_path($this->setup->get('REQUEST_HREF'), true); $current_path = $this->to_path($current_href); if (!is_dir($current_path)) { diff --git a/src/_h5ai/backend/php/core/class-setup.php b/src/_h5ai/backend/php/core/class-setup.php index 97009620..ce2dbcd8 100644 --- a/src/_h5ai/backend/php/core/class-setup.php +++ b/src/_h5ai/backend/php/core/class-setup.php @@ -59,7 +59,7 @@ class Setup { $this->set('PASSHASH', PASSHASH); $this->set('REQUEST_METHOD', getenv('REQUEST_METHOD')); - $this->set('REQUEST_URI', getenv('REQUEST_URI')); + $this->set('REQUEST_HREF', parse_url(getenv('REQUEST_URI'), PHP_URL_PATH)); $this->set('SCRIPT_NAME', getenv('SCRIPT_NAME')); $this->set('SERVER_SOFTWARE', getenv('SERVER_SOFTWARE')); } diff --git a/src/_h5ai/public/.htaccess b/src/_h5ai/public/.htaccess index c8a3286d..fce2793e 100644 --- a/src/_h5ai/public/.htaccess +++ b/src/_h5ai/public/.htaccess @@ -18,28 +18,10 @@ AddDefaultCharset utf-8 ExpiresActive on ExpiresDefault "access plus 1 month" - # CSS - ExpiresByType text/css "access plus 1 week" - - # Data interchange - ExpiresByType application/json "access plus 0 seconds" - ExpiresByType application/xml "access plus 0 seconds" - ExpiresByType text/xml "access plus 0 seconds" - - # Favicon (cannot be renamed!) - ExpiresByType image/x-icon "access plus 1 week" - - # HTML ExpiresByType text/html "access plus 0 seconds" + ExpiresByType application/json "access plus 0 seconds" - # JavaScript + ExpiresByType text/css "access plus 1 week" ExpiresByType application/javascript "access plus 1 week" - - # Media - ExpiresByType image/jpeg "access plus 1 month" - ExpiresByType image/png "access plus 1 month" - - # Web fonts - ExpiresByType application/font-woff "access plus 1 month" - ExpiresByType image/svg+xml "access plus 1 month" + ExpiresByType image/x-icon "access plus 1 week" diff --git a/src/_h5ai/public/index.php b/src/_h5ai/public/index.php index 448263a1..41e568ce 100644 --- a/src/_h5ai/public/index.php +++ b/src/_h5ai/public/index.php @@ -4,7 +4,7 @@ define('MIN_PHP_VERSION', '5.4.0'); if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) { header('Content-type: text/plain;charset=utf-8'); - echo '[{{pkg.name}} {{pkg.version}}] PHP ' . MIN_PHP_VERSION . '+ required, only found PHP ' . PHP_VERSION; + echo '[err] {{pkg.name}} requires PHP ' . MIN_PHP_VERSION . ' or later, but found PHP ' . PHP_VERSION; exit; }