pabloBar
pabloBar

Reputation: 317

htaccess not caching php file?

I have the following rules in the htaccess file:

<IfModule mod_headers.c>
  <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
    Header set Cache-Control "max-age=62, public"
  </FilesMatch>
</IfModule>

and in my php file(test.php) i have the following code

echo "time: ".time();

So now when i request the file i am seeing that the cache control is applied but the server is not providing the cache version.

For the record, i am using xampp environment.

Upvotes: 0

Views: 49

Answers (1)

user149341
user149341

Reputation:

Setting a Cache-Control header in a response, as you're doing here, only directs clients to cache the page. It doesn't trigger any server-side caching.

(Additionally, clicking the reload button in a browser will ignore the Cache-Control header and always request the content from the server again. That's the whole point of reloading the page, after all!)

Upvotes: 1

Related Questions