From 145f1549bdb1d25415372e6ff12c3acbaee5e86f Mon Sep 17 00:00:00 2001 From: severak Date: Thu, 16 Jan 2020 13:20:28 +0100 Subject: [PATCH] Proper caching and cache avoidance. --- .htaccess | 11 ++++++++++- one.php | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index d6bc739..bc501ad 100644 --- a/.htaccess +++ b/.htaccess @@ -3,4 +3,13 @@ #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule ^(.*)$ index.php [QSA,L] -# TODO - https://github.com/phanan/htaccess#set-expires-headers \ No newline at end of file + + ExpiresActive on + ExpiresDefault "access plus 1 week" + ExpiresByType text/html "access plus 0 seconds" + + + + Header unset ETag + +FileETag None \ No newline at end of file diff --git a/one.php b/one.php index ef1c571..7749f0e 100644 --- a/one.php +++ b/one.php @@ -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']);