-
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添加共享打印机提示错误0x0000709?..2024-03-28
- win11没有蓝牙驱动?四种解决方法揭秘..2024-03-27
- Win11游戏提示找不到d3dx9?看这一招轻..2024-03-26
- win11提示英特尔无线蓝牙问题?看这里..2024-03-25
- Win11没有文本文档?教你轻松解决右键..2024-03-20
- Win11提示操作无法完成,错误0x00000bc..2024-03-09
相关推荐
- Edge、Chrome和Firefox中取消阻止Adobe Fla..2021-05-23
- xp系统AdsL宽带连接方法的还原方案..2017-06-22
- 修复宽带开机时候连接很慢XP中的详细..2017-05-06
- 更换windows xp系统开机启动铃声的方法..2017-10-12
- xp系统已经阻止此站点用不安全方式使..2017-10-12
- xp系统下优酷无法加载播放器如何解决..2020-12-27