Link to home
Start Free TrialLog in
Avatar of GEMCC
GEMCC

asked on

Leverage browser caching

Hello,

I am running Google's PageSpeed test and am coming up with:

Leverage browser caching

Everything I am finding is not clear to me.  The site is on an Apache server and I have the expire and header modules running.

Please advise.

Have a great day,

Don
ASKER CERTIFIED SOLUTION
Avatar of Mohamed Magdy
Mohamed Magdy
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You may also want to consider adding an expiration on the server so you can send a 304 header for resources that have not changed.  For example, your server does not need to send the same picture over and over again - just tell the browser that the last copy is still OK.
Avatar of GEMCC
GEMCC

ASKER

Hello,

I got everything installed and working and it sped things up a lot!

One thing I am not sure about, if I understand correctly, step 4 is a config for WordPress.  I am not using WP so where would I place this code/script?

Have a great weekend,

Don
Step 4 can be made with any type of websites that's why I copied it over to you as it will cache CSS, images, JS, icons and PDF.
Avatar of GEMCC

ASKER

Understood, but where do I put the code/script?
In a file called .htaccess beside your website files in the same folder.
Avatar of GEMCC

ASKER

Gotcha, there is not an .htaccess file in the same directory as the web files.  Should I just create one and copy your info?
Avatar of GEMCC

ASKER

Still waiting on an answer regarding not having an .htaccess file.  Please advise.

In the meantime, I see what you mean, the PageSpeed test fluctuates by 10+ points even if I have not made any changes!

Please let me know about the .htaccess file.

Have a great day,

Don
Avatar of David Johnson, CD
yes create one and put it in your website root folder
I'm so sorry I was out of town, yes as David said, create one in your website root folder and put info inside it.
Avatar of GEMCC

ASKER

Hello,

I created the .htacces file and added the code you provided, but still the same issue.

Please advise.

Have a great day,

Don
When you open Leverage browser caching in PageSpeed, what URLs are you seeing? Are they external links? because if their were external links you can't cache them.

The code I provided will cache local files but it won't cache external links.

You can find the result of PageSpeed on my website in an attached image, you can find in it that the un cached links are all external.
2015-05-07-11-30-04.png
FYI, external links are cached from the external source and it's not possible to cache them until you serve them locally.
Avatar of GEMCC

ASKER

Hello,

The ones I am seeing are PNG files are supposedly not being cached, but your code has PNG set.

Please advise.

Have a great weekend,

Don
Could you please post a screenshot of the links?
Avatar of GEMCC

ASKER

Well, actually, now it is all cleared up!  I guess it took a while.

Thanks for your help,

Don
Avatar of GEMCC

ASKER

Resolved issue.
That's nice to hear, you welcome anytime :)