I've checked my plesk control panel on my vps and those mods are installed but when I run the site through http://redbot.org/ to check what's being sent, I get:
This response is negotiated, but doesn't have an appropriate Vary header.
The max-age Cache-Control directive appears more than once.
Cache-Control: no-cache, max-age=0, must-revalidate, no-transform, max-age=300
So it doesn't look like it's working.
Here's the .htaccess that I edited:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files web.config>
Order deny,allow
Deny from all
</Files>
# This denies access to all yml files, since developers might include sensitive
# information in them. See the docs for work-arounds to serve some yaml files
<Files *.yml>
Order allow,deny
Deny from all
</Files>
# Define some expiry header settings.
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 5 minutes"
ExpiresByType image/gif "access plus 7 day"
ExpiresByType image/png "access plus 7 day"
ExpiresByType image/jpg "access plus 7 day"
ExpiresByType image/jpeg "access plus 7 day"
ExpiresByType image/ico "access plus 7 day"
ExpiresByType text/css "access plus 7 day"
ExpiresByType text/javascript "access plus 7 day"
ExpiresByType application/x-javascript "access plus 7 day"
</IfModule>
# Append the 'Vary: Accept-Encoding' for resources that might need it.
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase '/'
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.php$
RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###
I'm just trying to add a little client-side caching to my site and I was also advised to add the old Vary:Accept-Encoding for clients that can't handle gzip - apparently it's best practice to.
Any ideas where I'm going wrong here?
Your htaccess file has
It may be that your VPS doesn't have the mod_expires installed for apache. If that is the case then it would make sense that the expires configuration wouldn't get applied.