giteshss2 Posted January 18, 2017 Share Posted January 18, 2017 Greetings! Am a developer, new to the business. while going across google page speed for the simplest site hosted by me, i came across some issues: Should Fix: Eliminate render-blocking JavaScript and CSS in above-the-fold content Consider Fixing: Leverage browser caching i have googled the problem but was unable to find a quick and specific solution. Can Someone Help? Quote Link to comment Share on other sites More sharing options...
Krydos Posted January 18, 2017 Share Posted January 18, 2017 Here's an example of browser caching that I use. Just create a .htaccess file in your web root with the contents # Cache ExpiresActive On ExpiresDefault A0 # 1 YEAR - doesn't change often <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> ExpiresDefault A31536000 </FilesMatch> # 1 WEEK - possible to be changed, unlikely <FilesMatch "\.(js|css|jpg|jpeg|png|gif|swf)$"> ExpiresDefault A604800 </FilesMatch> # 3 HOUR - core content, changes quickly <FilesMatch "\.(txt|xml)$"> ExpiresDefault A10800 </FilesMatch> # 1 YEAR <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> Header set Cache-Control "max-age=31536000, public" </FilesMatch> # 1 WEEK <FilesMatch "\.(js|css|jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch> # 3 HOUR <FilesMatch "\.(txt|xml)$"> Header set Cache-Control "max-age=10800" </FilesMatch> # NEVER CACHE - notice the extra directives <FilesMatch "\.(html|htm|php|cgi|pl)$"> Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate" </FilesMatch> <FilesMatch ".(js|css)$"> Header append Vary: Accept-Encoding </FilesMatch> Here's a good guide for getting the above the fold content to load faster on your page https://varvy.com/pagespeed/render-blocking.html Quote Link to comment Share on other sites More sharing options...
giteshss2 Posted January 19, 2017 Author Share Posted January 19, 2017 Thanks a lot krydos.That seems to be very helpful. Giving it a try.Thank you once again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.