-
apache提示没有设置 max-age or expires解决办法
- 作者:唐淑群 分类:xp 发布时间:2017-10-12 21:37:56
大家看到这个就应该知道只要设置 max-age or expires就行了。下面说的方法是在设置apache下的方法: 产生要开启 代码如下 LoadModule headers_module modules/mod_headers.so 然后再在.htaccess文件下面写上 代码如下 IfModule mod_headers.c FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$" Header set Cache-Control "max-age=604800, public" /FilesMatch FilesMatch "\.(xml|txt)$" Header set Cache-Control "max-age=18000, public, must-revalidate" /FilesMatch FilesMatch "\.(html|htm|php|shtml)$" Header set Cache-Control "max-age=3600, must-revali...
大家看到这个就应该知道只要设置 max-age or expires就行了。下面说的方法是在设置apache下的方法:
产生要开启
代码如下LoadModule headers_module modules/mod_headers.so
然后再在.htaccess文件下面写上
代码如下<IfModule mod_headers.c>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=18000, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(html|htm|php|shtml)$">
Header set Cache-Control "max-age=3600, must-revalidate"
</FilesMatch>
</IfModule>
如果没有开启“mod_headers”模块,而又没有加“”条件判断的话,网站就会出错!
设置 max-age or expires是用来缓存静态文件,提升网站的的加载速度!
猜您喜欢
- 电脑提示不满足Win11最低要求?看这里..2024-04-30
- win11无注册类运行软件提示?快速修复..2024-04-26
- win11提示不显眼?三大技巧轻松解决,..2024-04-08
- Win11提示执行操作需联网?教你一招轻..2024-04-03
- Win11添加共享打印机提示错误0x0000709?..2024-03-28
- win11没有蓝牙驱动?四种解决方法揭秘..2024-03-27
相关推荐
- xp系统打开程序显示无法找到入口 xp系..2022-02-03
- xp系统显卡性能不够问题(针对大型游..2017-05-30
- 探索神秘宝藏:OPPO云服务存储空间,..2023-11-16
- 显卡价格飙升,未来走势预测:科技市..2023-11-22
- windows xp系统左撇子用户如何对鼠标的..2017-10-12
- 揭秘神秘莫测的Mdf文件:深度解析与用..2023-11-06