Jump to content

Recommended Posts

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?

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...