Your SlideShare is downloading. ×
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
How to cache your static resources
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

How to cache your static resources

441

Published on

A simple and short presentation explaining what caching is, why you should start caching your static resources (CSS, Javascript and image files for example) and shows the code which enables caching in …

A simple and short presentation explaining what caching is, why you should start caching your static resources (CSS, Javascript and image files for example) and shows the code which enables caching in your users browsers.

Note: This tutorial is only for XAMPP server installations

Published in: Self Improvement, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
441
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. How to cache static resources
  • 2. What is caching?
  • 3. ”Caching (pronounced “cashing”) is the process of storing data in a cache”
  • 4. What is a cache then?
  • 5. ”A cache is a temporary storage area.”
  • 6. Why should I cache static resources?
  • 7. • The website loads faster for the users • The server doesn't have to be bothered by any unnecessary traffic.
  • 8. How to start caching This tutorial is only for XAMPP server installations
  • 9. • Make sure the mod_expires module is installed and turned on in your apache server configuration. • Make sure the mod_headers module is installed and turned on in your apache server configuration. • Make sure your hosting company allows you to use a .htaccess file.
  • 10. The .htaccess code The lines starting with an # are comments meant to explain the code written directly below it.
  • 11. # Turn on Expires and set default to 0 ExpiresActive On ExpiresDefault A0 ! # Set up caching on media files for 1 year (forever?) ! ExpiresDefault A29030400 Header append Cache-Control "public" ! # Set up caching on media files for 1 week ! ExpiresDefault A604800 Header append Cache-Control "public" ! # Set up 2 Hour caching on commonly updated files ! ExpiresDefault A7200 Header append Cache-Control "proxy-revalidate" ! # Force no caching for dynamic files ! ExpiresActive Off Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" Header set Pragma "no-cache"
  • 12. Recommendations • Use expires instead of Cache-control: max-age (expires is more widely supported) • Set expires to a minimum of one month for static resources. • Don't set expires more than one year into the future.(It violates the RFC guidelines). • Set last-modified to the last date the resource was changed.
  • 13. Resources • What is caching? • Google: Optimize caching • Speed up your site with caching and cache-control • Convert Apache .htaccess to NGINX • Apache caching guide

×