Posted By

discipolo on 03/06/11


Tagged

htacces


Versions (?)

ETag and expire headers for drupal 7


 / Published in: PHP
 

URL: http://blog-das-oertchen.de/blog/2011/02/15/drupal-sinnvolle-optimierungen-teil-3

yslow optimization

  1. # Cache specified files for 31 days
  2. <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|swf)$">
  3. Header set Cache-Control "max-age=2678400, public"
  4. </filesmatch>
  5. # Cache HTML files for a couple hours
  6. <filesmatch "\.(html|htm)$">
  7. Header set Cache-Control "max-age=7200, private, must-revalidate"
  8. </filesmatch>
  9. # Cache PDFs for a day
  10. <filesmatch "\.(pdf)$">
  11. Header set Cache-Control "max-age=86400, public"
  12. </filesmatch>
  13. # Cache CSS for 6 days
  14. <filesmatch "\.(css|css.gz)$">
  15. Header set Cache-Control "max-age=518400, private"
  16. </filesmatch>
  17. # Cache Javascripts for 31 days
  18. <filesmatch "\.(js|js.gz)$">
  19. Header set Cache-Control "max-age=2678400, private"
  20. </filesmatch>
  21.  
  22. Header append Vary Accept-Encoding
  23. # Turn ETags Off
  24. <IfModule mod_headers.c>
  25. </IfModule>
  26.  
  27. FileETag None

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: weberer on August 25, 2013

At first you should enable mod_expires apache module. execute sudo a2enmod expires in the terminal. If you see the following output, you can be sure that it has been enabled.

dpac@dpac-laptop:~$ sudo a2enmod expires Enabling module expires. Run '/etc/init.d/apache2 restart' to activate new configuration! By http://prowebdesigner.com.au

You need to login to post a comment.