apache_conf htaccess设置浏览器缓存

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf htaccess设置浏览器缓存相关的知识,希望对你有一定的参考价值。

# http://socreativedigital.com/7-htaccess-file-examples-that-work-for-seo-2013-05-04
# Pingdom was another SEO tool I used but one I think is bettered by Google’s
# Pagespeed Insights. Both tools test the speed of your webpage and produce a
# report which details what it is on your webpage which is slowing the page
# down when loaded onto a visitors browser.
#
# They suggested that I should leveraged browser caching to reduce load time
# and enabling previous visitors to downloaded resources from their own cache
# rather than over the network (that’s assuming that they don’t clean their browser
# cache, and are regular visitors to my site).
#
# With the htaccess file you can set the lifetime for cacheable resources like
# images, HTML, CSS, JavaScript ect. Enter the code below and set the max-age
# (which is set in seconds) to at least 1 week.
#
#
# 1 WEEK 1 DAY
<filesMatch “.(jpg|jpeg|png|gif|swf|ico)$”>
Header set Cache-Control “max-age=691200, public”
</filesMatch>
# 1 WEEK 1 DAY
<filesMatch “.(xml|txt|js)$”>
Header set Cache-Control “max-age=691200, proxy-revalidate”
</filesMatch>
# 1 WEEK 1 DAY
<filesMatch “.(html|htm|css|php)$”>
Header set Cache-Control “max-age=691200, private, proxy-revalidate”
</filesMatch>
#
#
# All the above htaccess code dealt with my Server behaviour issues for SEO and
# gave me the maximum score of 10 on Nibbler.

以上是关于apache_conf htaccess设置浏览器缓存的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf HTACCESS - 基本设置

apache_conf htaccess:利用浏览器缓存的指令

apache_conf 使用.htaccess设置密码

apache_conf 使用.htaccess启用和禁用浏览器缓存

apache_conf .htaccess - 强制文件在浏览器中下载

apache_conf 通过htaccess利用浏览缓存。