Alternative mod_expires for setting expiration headers?

I am using php on an Apache server. I cannot set the expiration headers in .htaccess on the server I'm working on, since it is a shared server and they (web host) will not install the mod_expires module in the apache assembly. I always used ExpiresActive Onand set the default cache expiration for images js, xmland text files in a file .htaccess.

What are my other options?

thank.

+3
source share
2 answers

You can do this with .htaccess and without mod_expires.

<IfModule mod_headers.c>
  <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Expires "Wed, 15 Apr 2020 20:00:00 GMT"
    Header set Cache-Control "public"
  </FilesMatch>
</IfModule>
+4
source

- Apache, , , , PHP . PHP .

+1

Source: https://habr.com/ru/post/1726666/


All Articles