Mobile app version of vmapp.org
Login or Join
Megan663

: .htaccess file not caching I have read several guides for how to write the htaccess file for caching but with no success. I asume I wrote something wrong and need some help on finding what

@Megan663

Posted in: #Apache #Cache #Htaccess

I have read several guides for how to write the htaccess file for caching but with no success. I asume I wrote something wrong and need some help on finding what i did wrong. Here's my htaccess file:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ www.%{HTTP_HOST}/ [R=301,L]

# 1 YEAR - doesn't change often
<FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
Header set Cache-Control "proxy-revalidate, max-age=31536000"
</FilesMatch>

# 1 WEEK - possible to be changed, unlikely
<FilesMatch ".(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "proxy-revalidate, max-age=604800"
</FilesMatch>

# 3 HOUR - core content, changes quickly
<FilesMatch ".(txt|xml|js|css)$">
Header set Cache-Control "proxy-revalidate, max-age=10800"
</FilesMatch>


The non-www to www rewrite is working fine btw

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

1 Comments

Sorted by latest first Latest Oldest Best

 

@Radia820

Try using the mod_expires syntax using something like this:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 2 week"
ExpiresByType image/jpeg "access 2 week"
ExpiresByType image/gif "access 2 week"
ExpiresByType image/png "access 2 week"
ExpiresByType text/css "access 2 week"
ExpiresByType text/html "access 1 hour"
ExpiresByType application/pdf "access 2 week"
ExpiresByType text/x-javascript "access 2 week"
ExpiresByType application/x-shockwave-flash "access 2 week"
ExpiresByType image/x-icon "access 1 month"
ExpiresDefault "access 2 week"
</IfModule>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme