Jump to content


Photo

Leverage Browser Caching

Leverage browser caching

  • Please log in to reply
3 replies to this topic

#1 anush

anush

    vanquisher

  • Members
  • PipPipPipPipPip
  • 396 posts
  • Gender:Male
  • Location:Internet
  • Interests:#bash

Posted 17 February 2012 - 09:52 AM

Can any what is meant by Leverage browser caching and Specify a Vary: Accept-Encoding header.

how can it me implemented with php



sorry

when i tried to post this some internal error occurred that is why there is 2 post.if any admin can remove it please remove it i have closed that one.

#2 viclou

viclou

    Rank III Member

  • Members
  • PipPipPip
  • 139 posts
  • Gender:Male
  • Location:Washington DC

Posted 18 February 2012 - 01:00 AM

It can be implemented by the .htaccess file... but I'm not sure with PHP.
Here are 2 examples:
## 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 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 2 days"
</IfModule>
## EXPIRES CACHING ##
and
# Set Cache-Control and Expires headers
<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$">
Header set Cache-Control "max-age=2592000, private"
Header set Expires "Sun, 17 July 2011 20:00:00 GMT"
</filesMatch>
<filesMatch "\\.(css|css.gz)$">
Header set Cache-Control "max-age=604800, private"
</filesMatch>
<filesMatch "\\.(js|js.gz)$">
Header set Cache-Control "max-age=604800, private"
</filesMatch>
<filesMatch "\\.(xml|txt)$">
Header set Cache-Control "max-age=216000, private, must-revalidate"
</filesMatch>
<filesMatch "\\.(html|htm)$">
Header set Cache-Control "max-age=7200, private, must-revalidate"
</filesMatch>


#3 anush

anush

    vanquisher

  • Members
  • PipPipPipPipPip
  • 396 posts
  • Gender:Male
  • Location:Internet
  • Interests:#bash

Posted 18 February 2012 - 05:19 AM

Attached File  rank.jpg   73.03K   4 downloads

Thank you for your help but after i added you code to my .htaccess , my performance grade increased by just 2 and still the pingdom tools Recommend me to Leverage browser caching and set Accept-Encoding header.

#4 viclou

viclou

    Rank III Member

  • Members
  • PipPipPip
  • 139 posts
  • Gender:Male
  • Location:Washington DC

Posted 19 February 2012 - 02:18 AM

set Accept-Encoding header means you have to set the encoding on each file you have... but I'm not sure how to do that!

But yes, you're welcome!





Also tagged with one or more of these keywords: Leverage browser caching

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users