NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page Htaccess Code for Better Caching

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
6 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 12-21-2010, 09:30 AM THREAD STARTER               #1 (permalink)
i love automation
 
xrvel's Avatar
Join Date: Nov 2007
Location: xrvel.com
Posts: 1,615
xrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant future
 




Thumbs up Htaccess Code for Better Caching


I got this htaccess code from "tips section" on Vbulletin forum.
????: NamePros.com http://www.namepros.com/code/692916-htaccess-code-for-better-caching.html
This htaccess code provides better caching for your static files
You can just add it on your .htaccess file.

Code:
<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 259200000 seconds"
  ExpiresByType image/jpeg "access plus 259200000 seconds"
  ExpiresByType image/png "access plus 259200000 seconds"
  ExpiresByType text/css "access plus 60480000 seconds"
  ExpiresByType text/javascript "access plus 21600000 seconds"
  ExpiresByType application/x-javascript "access plus 21600000 seconds"
</ifModule>
<ifModule mod_headers.c>
  <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
    Header merge Cache-Control "max-age=25920000, public"
  </filesMatch>
  <filesMatch "\\.(css)$">
    Header set Cache-Control "max-age=6048000, public"
  </filesMatch>
  <filesMatch "\\.(js)$">
    Header set Cache-Control "max-age=2160000, private"
  </filesMatch>
  <filesMatch "\\.(xml|txt)$">
    Header set Cache-Control "max-age=2160000, public, must-revalidate"
  </filesMatch>
  <filesMatch "\\.(html|htm|php)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
  </filesMatch>
</ifModule>
<ifModule mod_headers.c>
  Header unset ETag
</ifModule>
FileETag None
<ifModule mod_headers.c>
  Header unset Last-Modified
</ifModule>
__________________
xrvel is offline   Reply With Quote
Reply

Tags
cache, caching, htaccess, performance


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Empire Technology VPS Sale Free Crontrol Panels Lowesthost Web Hosting Offers 0 09-12-2010 07:42 PM
Empire Technology Xen, Hybrid Servers & Vituozzo Server Sale Lowesthost Web Hosting Offers 0 06-07-2010 07:19 PM
Handy Javascript Code Snips DNVC CODE 3 07-21-2007 11:18 AM
End of Year Special Plans - Perfect for Resellers! True 99.9% Uptime Guarantee! BlikWerk Web Hosting Offers 0 12-27-2005 03:24 PM
17 Canada Databases For Sale odditysoftware Content For Sale 0 12-13-2005 09:08 PM

 
All times are GMT -7. The time now is 07:38 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger