{"id":165,"date":"2012-07-31T18:41:24","date_gmt":"2012-07-31T18:41:24","guid":{"rendered":"http:\/\/vickistan.com\/?p=165"},"modified":"2015-12-03T15:26:06","modified_gmt":"2015-12-03T15:26:06","slug":"browser-side-caching-with-apache","status":"publish","type":"post","link":"https:\/\/vickistan.com\/?p=165","title":{"rendered":"Browser-Side Caching with Apache"},"content":{"rendered":"<p>Browser-side caching relies on HTTP headers to know whether or not the content it has in its local cache is still valid. If it is, then it uses the local copy, rather than downloading the file from the server again. Many sites like whysoslow.com will report that you&#8217;re missing this HTTP header on your static files, which is normal, since you aren&#8217;t explicitly setting that in the files, since they&#8217;re mostly images and the like. In order to improve browser-side caching of your static content you could add mod_expires to your Apache configuration. This would add the necessary HTTP headers to make browser-side caching of your static content possible.<\/p>\n<p>Install mod_expires and add the following to the .htaccess:<\/p>\n<p># Deflate output configuration<br \/>\n#<br \/>\nAddOutputFilterByType DEFLATE text\/html text\/plain text\/xml text\/javascript text\/css application\/javascript<br \/>\n#AddOutputFilterByType DEFLATE text\/html text\/plain text\/xml text\/css<br \/>\nBrowserMatch ^Mozilla\/4 gzip-only-text\/html<br \/>\nBrowserMatch ^Mozilla\/4\\.0[678] no-gzip<br \/>\nBrowserMatch \\bMSIE !no-gzip !gzip-only-text\/html<\/p>\n<p>ExpiresActive On<br \/>\nExpiresDefault &#8220;access plus 1 month&#8221;<br \/>\nExpiresByType image\/png &#8220;access plus 1 month&#8221;<br \/>\nExpiresByType image\/gif &#8220;access plus 1 month&#8221;<br \/>\nExpiresByType image\/jpeg &#8220;access plus 1 month&#8221;<br \/>\nExpiresByType text\/css &#8220;access plus 1 month&#8221;<\/p>\n<p>AddType image\/x-icon .ico<br \/>\nExpiresByType image\/x-icon &#8220;access plus 1 year&#8221;<br \/>\nExpiresByType image\/ico &#8220;access plus 1 years&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Browser-side caching relies on HTTP headers to know whether or not the content it has in its local cache is still valid. If it is, then it uses the local copy, rather than downloading the file from the server again. &hellip; <a href=\"https:\/\/vickistan.com\/?p=165\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,3],"tags":[],"class_list":["post-165","post","type-post","status-publish","format-standard","hentry","category-apache","category-linux"],"_links":{"self":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165"}],"version-history":[{"count":5,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":717,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions\/717"}],"wp:attachment":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}