Pages

Showing posts with label speed. Show all posts
Showing posts with label speed. Show all posts

Friday, October 4, 2013

Page Speed-Enable gzip compression

Add the following code to .htaccess(preferably in root)


 # compress text, HTML, JavaScript, CSS, and XML  
 AddOutputFilterByType DEFLATE text/plain  
 AddOutputFilterByType DEFLATE text/html  
 AddOutputFilterByType DEFLATE text/xml  
 AddOutputFilterByType DEFLATE text/css  
 AddOutputFilterByType DEFLATE text/javascript  
 AddOutputFilterByType DEFLATE application/xml  
 AddOutputFilterByType DEFLATE application/xhtml+xml  
 AddOutputFilterByType DEFLATE application/rss+xml  
 AddOutputFilterByType DEFLATE application/javascript  
 AddOutputFilterByType DEFLATE application/x-javascript  
 # remove browser bugs  
 BrowserMatch ^Mozilla/4 gzip-only-text/html  
 BrowserMatch ^Mozilla/4\.0[678] no-gzip  
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html  
 Header append Vary User-Agent  

Thursday, October 3, 2013

Page Speed-Leverage browser caching

Make sure that Browser cache expire time should be at least 
1 week for consistent things. This can be reduced files that change constantly.
 
To add this add following like structure in .htaccess
(preferably root can be changed to taste in some cases)
 
 
 ## EXPIRES CACHING ##  
 ExpiresActive On  
 ExpiresByType image/jpg "access plus 1 year"  
 ExpiresByType image/jpeg "access plus 1 year"  
 ExpiresByType image/gif "access plus 1 year"  
 ExpiresByType image/png "access plus 1 year"
 ExpiresByType text/javascript "access plus 1 month"
 ExpiresByType text/css "access plus 1 month"
 ExpiresByType application/pdf "access plus 1 month"  
 ExpiresByType text/x-javascript "access plus 1 month"  
 ExpiresByType application/x-shockwave-flash "access plus 1 month"  
 ExpiresByType image/x-icon "access plus 1 year"  
 ExpiresDefault "access plus 2 days"  
 ## EXPIRES CACHING ##  

Page Speed-Specify a Vary: Accept-Encoding header


 <IfModule mod_headers.c>  
  <FilesMatch "\.(js|css|xml|gz)$">  
   Header append Vary Accept-Encoding  
  </FilesMatch>  
 </IfModule>  
If you would like to add more file type to this rule, add the its extension to the statement