Forum

Questions and discussions

Leverage browser caching

Script's setup and configuration

Leverage browser caching

Postby Stonewolf » Thu May 26, 2016 7:03 am

Hello,

If someone looks for an improvement regarding page testing with gtmetrix.com or tools.pingdom.com, you need to adjust your root .htaccess file. Check the steps below:

1. add following to your .htaccess file at the very TOP:
<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 application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>

But, be very careful with the values; if you update your application constantly (let's say once per month), you should set values less than the actual! Otherwise, your users won't get the updates properly!

2. by default, apache doesn't have the function "expires_module" activated; how to activate?
If you have SSH, simply in your terminal type following (once you're on root):
sudo a2enmod expires (wait until it shows "Enabling module expires.");
Then type:
service apache2 restart
Wait 5 minutes or less till the service starts.

That's it. You'll have leverage browser caching enabled and activated. This will increase dramatically your performance.


Cheers,
Alex
Stonewolf
 
Posts: 2
Joined: Mon May 23, 2016 12:36 pm

Re: Leverage browser caching

Postby admin » Thu Jun 09, 2016 7:43 am

Thank you, Alex, for the suggestion!
admin
Site Admin
 
Posts: 1465
Joined: Sun Mar 07, 2010 5:55 pm

Re: Leverage browser caching

Postby stockdiv » Sat Jun 11, 2016 5:41 pm

used it. Is working fine. Thank you.
stockdiv
 
Posts: 119
Joined: Sat Feb 01, 2014 11:23 am


Return to Configuration

Who is online

Users browsing this forum: No registered users and 4 guests

cron
  Photo Store Script

Professional php photo stock script and WordPress plug-in for photographers and video producers.

  Support
  CMSaccount Inc.