apache2 cache control htaccess file

Suggestions / Chats / News
Tools/Utilities Share
Web Development
Job Opportunties
Basically Everything Else.
Post Reply
doctorlai
Site Admin
Posts:44
Joined:Tue Jan 15, 2013 3:16 pm
apache2 cache control htaccess file

Post by doctorlai » Sun Jun 28, 2015 11:49 am

Code: Select all

 # 1 Month for all your static assets
 <filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
 Header set Cache-Control "max-age=2592000, public"
 </filesMatch>
 
 # 1 DAYS for rss feeds and robots
 <filesMatch ".(xml|txt)$">
 Header set Cache-Control "max-age=86400, public, must-revalidate"
 </filesMatch>
 
 # 4 HOURS for your real articles files
 <filesMatch ".(html|htm)$">
 Header set Cache-Control "max-age=14400, must-revalidate"
 </filesMatch>


After I added above to the .htaccess, the site becomes unavailable. 500 internal error, any ideas?

doctorzlai
Posts:8
Joined:Tue Jan 15, 2013 4:06 pm

Re: apache2 cache control htaccess file

Post by doctorzlai » Mon Jun 29, 2015 10:58 pm

https://helloacm.com/speed-up-website-by-caching-static-resources-using-apache2-cache-control-htaccess/

you have to enable the headers module

Code: Select all

a2enmod headers


and restart the apache2 server by

Code: Select all

sudo /etc/init.d/apache2 restart


or

Code: Select all

sudo service apache2 restart


hope this work.

Post Reply