Jump to content

PAGE SPEED: Leverage browser caching


Recommended Posts

Hi all,

 

We have a website in prestashop

PS version: 1.4.3

PHP: 5.3.2

Website: www.marie-melodie.com

 

When we run 'page speed' we obtain following result as 'High Priority' modification

 

Leverage browser caching

 

Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.

Learn more

Suggestions for this page

 

The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:

 

And a list of files.

 

 

 

 

So we added in our .htaccess following

 

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/gif "access plus 1 month"

ExpiresByType image/jpeg "access plus 1 month"

ExpiresByType image/png "access plus 1 month"

ExpiresByType text/css "access plus 1 week"

ExpiresByType text/javascript "access plus 1 week"

ExpiresByType application/javascript "access plus 1 week"

ExpiresByType application/x-javascript "access plus 1 week"

ExpiresByType image/x-icon "access plus 1 year"

</IfModule>

 

FileETag INode MTime Size

<IfModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE text/javascript

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

</IfModule>

 

 

 

Unfortunately without any result.... still the same

 

 

Is there another way to solve this problem.

 

 

Thanks in advance

 

Jack

Link to comment
Share on other sites

Most shared hosting accounts to not have mod_expires turned on.

A simple test to see if not loaded, (yes, there are others), is to remove the check

<IfModule mod_expires.c>

and it's end if

</IfModule>

 

if it's not loaded you will get a 500 error...then put your changes back and talk to your hosting company (or talk to them first and not the code) about getting mod_expires...hint: if they allowed this on shared servers, there would be little reasons for most of us to pay for upgraded packages. :)

  • Like 2
Link to comment
Share on other sites

  • 4 months later...

Most shared hosting accounts to not have mod_expires turned on.

A simple test to see if not loaded, (yes, there are others), is to remove the check

<IfModule mod_expires.c>

and it's end if

</IfModule>

 

if it's not loaded you will get a 500 error...then put your changes back and talk to your hosting company (or talk to them first and not the code) about getting mod_expires...hint: if they allowed this on shared servers, there would be little reasons for most of us to pay for upgraded packages. :)

 

Salve elpatron,

I have checked with my shared environment (ixwebhosting - linux) and they told me that it is by default enabled, and that I should use internet to learn on how to use .htaccess. I have found some useful links, but I would like to know if there is any presta setting that could do it for us.

Huge thanks in advance

Link to comment
Share on other sites

Salve elpatron,

I have checked with my shared environment (ixwebhosting - linux) and they told me that it is by default enabled, and that I should use internet to learn on how to use .htaccess. I have found some useful links, but I would like to know if there is any presta setting that could do it for us.

Huge thanks in advance

 

Hi cogeanumarius,

 

I am pretty sure if you set 'Optimize' and click generate .htaccess it will provide the base browser cache values.

07.28.2012-13.26.55.png

http://screencast.com/t/vcn78anRal

 

Here is what was generated in one of our shops by PrestaShop.

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 year"
</IfModule>

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...