Levarage Browsing Cache

El Magico

Junior Member
Joined
Sep 13, 2017
Messages
199
Reaction score
32
I just went into my HT Access files and changed it to:

## EXPIRES CACHING ##
<IfModule mod_expires.c>
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/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"
</IfModule>
## EXPIRES CACHING ##


And according to GT metrix I still have score of E, I didn't change anything, is there anything I can do fix this up.
 
Why dont you try plugin to speed up your site ? i am not technical guy but its easy to do things using plugins.
 
There are two hard things in computer science: cache invalidation and naming things.

I hope you know what you are doing.
 
Does GTMetrix state E only for leverage cache or it's for overall rank?
 
You can't control external sources' leverage cache time though they are hosted on their own server.

For google analytics, remove all the tracking codes or plugins, and install this one - https://wordpress.org/plugins/host-analyticsjs-local/

It'll fix analytics cache issues.

Regarding image cache, try this on your htaccess replacing your's one -

Code:
# Leverage Browser Caching Starts here
<IfModule mod_expires.c>
 ExpiresActive On
  ExpiresDefault "access plus 2592000 seconds"
  ExpiresByType image/x-icon "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 2592000 seconds"
  ExpiresByType text/javascript "access plus 2592000 seconds"
  ExpiresByType application/javascript "access plus 2592000 seconds"
  ExpiresByType application/x-javascript "access plus 2592000 seconds"
  ExpiresByType text/html "access plus 600 seconds"
  ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>
# Leverage Browser Caching Ends here

If the problem exists, then contact to your host provider, there might be some limitation on your server.
 
You can't control external sources' leverage cache time though they are hosted on their own server.

For google analytics, remove all the tracking codes or plugins, and install this one - https://wordpress.org/plugins/host-analyticsjs-local/

It'll fix analytics cache issues.

Regarding image cache, try this on your htaccess replacing your's one -

Code:
# Leverage Browser Caching Starts here
<IfModule mod_expires.c>
 ExpiresActive On
  ExpiresDefault "access plus 2592000 seconds"
  ExpiresByType image/x-icon "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 2592000 seconds"
  ExpiresByType text/javascript "access plus 2592000 seconds"
  ExpiresByType application/javascript "access plus 2592000 seconds"
  ExpiresByType application/x-javascript "access plus 2592000 seconds"
  ExpiresByType text/html "access plus 600 seconds"
  ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>
# Leverage Browser Caching Ends here

If the problem exists, then contact to your host provider, there might be some limitation on your server.

Tried it out got mild improvement, Thanks any tips for fixing Optimize the order of styles and scripts?
 
After many years of bitter experience trying to speed up my websites and using a number of high-powered hosting solutions, I ended up switching to GoDaddy. I know that they get a bad rap, but since I did it I've never had to worry about site speed, caching, or bad guys trying to take my websites down.
 
I have this .htaccess on one of my sites:

But, before trying this, make sure you backup your current .htaccess file.

Code:
############## CACHING-GZIP ############

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A2592000

<FilesMatch "\.(txt|xml|js)$">
ExpiresDefault A2592000
</FilesMatch>

<FilesMatch "\.(css)$">
ExpiresDefault A2592000
</FilesMatch>
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
ExpiresDefault A2592000
</FilesMatch>

<FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
ExpiresDefault A2592000
</FilesMatch>

</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(txt|xml|js)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>

<FilesMatch "\.(css)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>

<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/atom+xml" \
"application/javascript" \
"application/json" \
"application/ld+json" \
"application/manifest+json" \
"application/rdf+xml" \
"application/rss+xml" \
"application/schema+json" \
"application/vnd.geo+json" \
"application/vnd.ms-fontobject" \
"application/x-font-ttf" \
"application/x-javascript" \
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/opentype" \
"image/bmp" \
"image/svg+xml" \
"image/vnd.microsoft.icon" \
"image/x-icon" \
"text/cache-manifest" \
"text/css" \
"text/html" \
"text/javascript" \
"text/plain" \
"text/vcard" \
"text/vnd.rim.location.xloc" \
"text/vtt" \
"text/x-component" \
"text/x-cross-domain-policy" \
"text/xml"
</IfModule>
<IfModule mod_mime.c>
AddEncoding gzip              svgz
</IfModule>
</IfModule>
 
Back
Top