Author Topic: Successful cache header for images, similar to .htaccess  (Read 1369 times)

0 Members and 1 Guest are viewing this topic.

Offline danny

  • Tireless poster
  • ****
  • Posts: 189
    • View Profile
    • Startfetch
Successful cache header for images, similar to .htaccess
« on: May 01, 2018, 06:11:44 AM »
in (alt+f6)

{.if|{.match|*.gif;*.ico;/*img*|%url%.}|{:{.add header|Cache-Control: public, max-age=31536000.}{.add header|Vary: Accept-Encoding.}:}.}

This is functionally similar to Apache .htaccess
Only the file extensions specified have been cached by the browser.

If you decide to cache a wider variety of file extensions, it may be useful to add the reversal command {.add header|Cache-Control: no-cache, max-age=0.} into the template at the [error-page] section, so as to reduce persistence of redirects.
« Last Edit: May 17, 2018, 05:04:05 PM by danny »

Follow members gave a thank to your post: