cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
estieg
Former Employee

How To Leverage Browser Caching With Managed WordPress Hosting - Tutorial

EskimoTom wrote,

“With what I know, we each have the ability to edit our .htaccess file. (Always Backup FIRST!) It's a very powerful document. So be careful or consult Support first with questions, which is what I plan to do.

 

I found TWO options for configuring our browser caching with in the .htaccess file on this page:

https://varvy.com/pagespeed/leverage-browser-caching.html

The example outlined by Serendipity above appears similar the OPTION ONE outlined on the above page. I may go with that first.

Here are the Two options from above page:

Option One

-----------------------------------------------------------

## 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 ##

----------------------------------------------

OPTION 2

----------------------------------------------

# 1 Month for most static assets

<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">

Header set Cache-Control "max-age=2592000, public"

</filesMatch>

-----------------------------------------------

Option TWO was referred as "Cache-Control" and "allows us to have a bit more control of our browser caching and many people find it easier to use once setup."

Perhaps someone here can point us all to a resource to help us edit our .htaccess files with "typical" or "suggested/recommended" parameters.

I did have an experience with our GoDaddy hosted site, getting hacked. Someone edited our .htaccess file and also uploaded a few nefarious pages and folders. GoDaddy Support did help me resolve that issue.

My understanding is the .htaccess file allows us each to modify how our site behaves in the wild when it is hosted in a shared hosting environment provided by GoDaddy and others.

Some folks have "typical" needs, for instance I just have one small business with a site here. Other folks may have private or membership sites hosted here and access to those sites can be configured and access limited to people with the proper credentials within the .htaccess file.

This is my simple understanding of the .htaccess and browser cache issues. If I have this wrong, will someone with deeper understanding help us out here and correct me.

If I answered your question, please mark it as the solution or give it a "Kudo"
1 REPLY 1

Re: How To Leverage Browser Caching With Managed WordPress Hosting - Tutorial

what if I use both options?