Utilizing expires headers is an important part of optimizing your website. At times it can be tricky. Apache2 configuration syntax is extremely particular. I’ve gathered a few items to check when you’ve experienced this issue.
1. Server logs
When troubleshooting anything with Apache 2, your first step should be checking the apache error log. The Apache logs will let you know everything that is going on with your web server.
The location is
2. Verify your modules are available
Within your default configuration file
/etc/apache2/sites-availableor your .htaccess files. There may be references to an Apache module that does not exist.
You may be familiar with this code in .htaccess
<IfModule mod_rewrite.c>. This is a if statement that will ignore any trailing directives before the closing tag. This will prevent Apache from crashing if the module is not present. Many will add a .htaccess directive without the if statement resulting in a crash if the module isn’t there.
3. Verify your Apache config files are correct
Apache has a few files you should be checking.
apache2.conf which is located at
envvars configuration file which is located in the same place
Your configuration files located in
apachectl -Son the command line
That’s about all I can think of when I troubleshoot Apache issues. Keep in mind, when troubleshooting Apache 2, your error logs are your best friend. If I’m missing something please let me know.