In an effort to become more organised in what I need to do when launching a new website, I created a checklist of pre and post launch tasks. I recently completed a site for some family friends (shameless plug, check it out) and it proved to be invaluable.
One thing I almost always forget to do is to set expires headers for static assets. To add expires headers to your apache vhost for static assets, simply add the following between your
This will set the expires headers for most image formats, as well as css and JS. I’ve added a check to ensure you have mod_expires first so we don’t have a ‘tango down’ moment if the module isn’t enabled.
Enable mod expires
If you haven’t already got mod expires enabled, just run the following command:
sudo a2enmod expires
That should do the trick. Give apache a restart and you’re ready to rock. Feel free to ask questions or share your thoughts below.