X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/43ef6e8dfd4345262f7b974506261e0827bfecae..90f0bc1550eb0e5291f215552b22143fbe5e9398:/src/stub-phar.php?ds=sidebyside diff --git a/src/stub-phar.php b/src/stub-phar.php index ac82a38..95e894c 100644 --- a/src/stub-phar.php +++ b/src/stub-phar.php @@ -47,7 +47,10 @@ function rewritePath($path) $path = rewriteWithHtaccess($path); - if (substr($path, -4) == '.css' || substr($path, -3) == '.js') { + if (substr($path, -4) == '.css' + || substr($path, -3) == '.js' + || substr($path, 0, 9) == '/phorkie/' + ) { header('Expires: ' . date('r', time() + 86400 * 7)); } return 'www' . $path; @@ -55,10 +58,10 @@ function rewritePath($path) function rewriteWithHtaccess($path) { - //remove the trailing slash / + //remove the leading slash / $cpath = substr($path, 1); $bFoundMatch = false; - $map = include(__DIR__ . '/../src/gen-rewritemap.php'); + $map = include('phar://' . __FILE__ . '/src/gen-rewritemap.php'); foreach ($map as $pattern => $replace) { if (preg_match($pattern, $cpath, $matches)) { $bFoundMatch = true;