Leverage Browser Caching

I’m guessing you’re on a shared host? If so they’re not likely to give you access to it.
But you could contact them and ask them to add it.

If they do, the htaccess will then work.
If they don’t your only recourse is to use meta http-equiv

If Godaddy is a shared host? then yes.
Ill ask them.

This isn’t entirely true. If you have PHP you could use the header() function, but that could be a lot more work to set up as you would need to rewrite requests for images to a PHP file that sent the headers and served up the image.

Yeah I thought of that too Ive seen examples of that.

Like So?: <meta http-equiv="Cache-control" content="public">

Yes, though unless the image will never change, you should probably use “expires” too
<meta http-equiv="Expires" content="aDate" />

and maybe “last-modified” as well
<meta http-equiv="Last-Modified" content="aDate" />

I have a web-page that nicks Google images from YouTube and had a very poor Pingdom Rating of only 44 due to “Leverage Browser caching”.

The KLUDGE to get the Pingdom Performance Grade = 100 was to save the images to a “thumbs” sub-domain on my server.

Looks like Google has their images Expiry Date set to zero!

I use a version of Ryan’s .htaccess code on my sites. (I learned it on a W3C course, so it must be good. ) All my sites are on shared hosting and I’ve never had a problem with this, so I’ll be surprised if it’s not enabled on GoDaddy.

Off Topic:

If you’re interested in a discussion about whether or not to remove the IfModule statement, try this one: IfModule checks in htaccess - performance impact?

2 Likes

I could have more than one?

Yeah ill have to ask them because the files required for .htaccess code to work I need those files which are currently not on my server…

Yes, you could have quite a few http-equivs if you wanted them.

Hopefully they will.
AFAIK at least some browsers give precedence to HTTP headers and will ignore http-equivs that conflict with them.

1 Like

What files do I need exactly? They did not let have the files they said I need full control of the server (VPS server?)

They’re likely there, just not enabled.

The ones you should ask for are the ones in the "IfModule"s you are wanting to use eg.
<IfModule mod_expires.c>

Though on my localhost it’s an “.so” not a “.c”
#LoadModule expires_module modules/mod_expires.so

They said that is not supported on shared and I need VPS / Dedicated Server oh well…I guess the META TAG it is…

They said that It does not support it in shared. That I need VPS Server…TO access that :expressionless:

I can see not giving access to the httpd.conf file.
If one site broke it every site that shared it could go down. Not a good thing.

But enabling mod_expires doesn’t seem like it would be a risk at all and I doubt it would cause excessive resource use.

Probably a “we only enable what we need to be able to run the hosting” and “if we do this one for this guy we’ll end up doing another for someone else, so NO, unless they’re willing to pay more”

1 Like

:joy: good point.

I put these meta tags in my website but the notification does not seem to go away does it take a while? I put them in between my <head></head> tag

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Cache-control" content="public">
<meta http-equiv="Expires" content="aDate" />

Give it a few days for Google to re-index your site.

1 Like

That’s where they go, but,
“aDate” should be an actual date in this syntax

So just as a few general questions:

The purpose of doing this is to instruct the browser to load previously downloaded resources from local disk rather than over the network. which is better correct?

What is the purpose of the expiry date? what happens when it reaches that date in time? is it to fetch new data like images and css for browsers/users? (not sure if I answered my own question :joy: )

I could put any date I want?

Do I need to continue to change the dates often?