Proper caching and cache avoidance.

This commit is contained in:
severak 2020-01-16 13:20:28 +01:00
parent 945aab3813
commit 145f1549bd
2 changed files with 12 additions and 1 deletions

View File

@ -3,4 +3,13 @@
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php [QSA,L]
# TODO - https://github.com/phanan/htaccess#set-expires-headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 week"
ExpiresByType text/html "access plus 0 seconds"
</IfModule>
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None

View File

@ -6,6 +6,8 @@ $config = require 'config.php';
error_reporting(0);
header('Content-type: text/plain');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
try {
$pdo = new MyPDO('sqlite:' . __DIR__ . '/' . $config['database']);