Reputation: 4154
I added an .htaccess
file to the website root folder /var/www/html
It looks like this
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
I tried adjusting theAllowOverride
option, as is recommended in a lot of places.
My /etc/apache2/sites-available/000-default.conf
file looks like this
<VirtualHost *:80>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
...
</VirtualHost *:80>
And /etc/apache2/apache2.conf
looks like this
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I'm fairly certain that the .htaccess
file is just not working, because when I add random characters to the file (to try and break it and get a 500
HTTP response) it doesn't affect the website at all.
What could be causing this?
Upvotes: 2
Views: 308
Reputation: 714
Expiry information is created and sent by the expires module. In accordance with that the .htaccess
correctly checks for the existence of this module. If it is not loaded, no action is taken here.
Make sure that the module is loaded correctly, the currently most compatible way to do this is with a2enmod
:
:~ $ a2enmod expires
Upvotes: 1