In continuing my efforts to improve SEO on a couple of my websites (Baker Street Systems and Utah Projectors), I've decided to implement file caching in Apache. This type of caching is ideal for these types of websites where the images, css, js, or any other kind of file doesn't change very much. Of course, during development of the websites, you'll be changing your css, js, and image files constantly so there is no need for file caching (in fact, it can end up being a headache!), but as soon as you launch your site to production you should be implementing some sort of file caching system.
First thing to do is to enable the caching module withing Apache.
sudo a2enmod expires
This next part can be done a number of ways (like through .htaccess files in the website code or in the global Apache config files), but I prefer to keep everything in the site-specific config file, i.e.
/etc/apache2/sites-available/bakerstreetsystems.com.conf. Just open that file up and add the following inside the
You can, of course, change how long each type of file should be cached. If you ever need to update the local cached file, all you need to do is perform a hard refresh in your browser and/or clear the local cache in the browser.