Lego2012
9/26/2016 - 9:00 PM

htaccess Set Browser Cache

htaccess Set Browser Cache

# 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.