Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- header("Cache-Control: private, max-age=604800 , pre-check=604800 ");
- header("Pragma: private");
- header("Expires: " . date(DATE_RFC822,strtotime("+2 day")));
- #file .htaccess
- ## 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 ##
- <IfModule mod_headers.c>
- Header set Connection keep-alive
- <filesmatch "\.(ico|flv|gif|swf|eot|woff|otf|ttf|svg)$">
- Header set Cache-Control "max-age=2592000, public"
- </filesmatch>
- <filesmatch "\.(jpg|jpeg|png)$">
- Header set Cache-Control "max-age=1209600, public"
- </filesmatch>
- # css and js should use private for proxy caching https://developers.google.com/speed/docs/best-practices/caching#LeverageProxyCaching
- <filesmatch "\.(css)$">
- Header set Cache-Control "max-age=31536000, private"
- </filesmatch>
- <filesmatch "\.(js)$">
- Header set Cache-Control "max-age=1209600, private"
- </filesmatch>
- <filesMatch "\.(x?html?|php)$">
- Header set Cache-Control "max-age=600, private, must-revalidate"
- </filesMatch>
- </IfModule>
Add Comment
Please, Sign In to add comment