我在 Apache 服务器上使用 php。我无法在我正在使用的服务器上的 .htaccess 中设置过期 header ,因为它是共享服务器,并且它们(网络主机)不会在 apache 构建中安装 mod_expires 模块。
我一直使用 ExpiresActive On
并为 .htaccess 中的图像、
文件。 js
、xml
和文本文件设置默认缓存过期时间
我还有哪些其他选择?
谢谢。
最佳答案
您可以使用 .htaccess 而无需 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>
关于php - 替代 mod_expires 来设置过期 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1966524/