Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Apache设置缓存控制最大年龄不起作用_Apache_Caching_Http Caching - Fatal编程技术网

使用Apache设置缓存控制最大年龄不起作用

使用Apache设置缓存控制最大年龄不起作用,apache,caching,http-caching,Apache,Caching,Http Caching,我正在尝试为我的网站设置HTTP缓存。以下是我的配置设置 # 1 YEAR <FilesMatch "\.(ico|svg|woff|eot|ttf)$"> Header set Cache-Control "max-age=31536000, public" </FilesMatch> # 1 WEEK <FilesMatch "\.(jpg|png|gif|css|js)$"> Header set Cache-Control "max-age=6048

我正在尝试为我的网站设置HTTP缓存。以下是我的配置设置

# 1 YEAR
<FilesMatch "\.(ico|svg|woff|eot|ttf)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>

# 1 WEEK
<FilesMatch "\.(jpg|png|gif|css|js)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
为什么没有缓存控制最大年龄标头标记

我还使用了检查,它仍然说没有为所有文件指定过期时间


我遗漏了什么吗?

由于我的
apache2.conf
文件中缺少一些配置设置,因此未考虑
.htaccess
文件。在conf文件中进行必要的更改解决了这个问题。

对.conf文件的更改是什么?
HTTP/1.1 200 OK
    Date: Fri, 12 Sep 2014 09:28:33 GMT
    Server: Apache/2.4.7 (Ubuntu)
    Last-Modified: Tue, 26 Aug 2014 05:43:32 GMT
    ETag: 1409031812.69
    Content-Length: 23907
    Keep-Alive: timeout=5, max=100
    Connection: Keep-Alive
    Content-Type: image/png