Results 1 to 10 of 13
Threaded View
-
25th May 2011, 11:57 AM #2OPMemberWebsite's:
eiswebhosting.com mastddl.comPart 2
Add future Expires and Cache-Control headers
A first-time visitor to your page will make several HTTP requests to download all your sites files, but using the Expires and Cache-Control headers you make those files cacheable. This avoids unnecessary HTTP requests on subsequent page views.
To set your Expires headers add these lines to your .htaccess:
Code:<ifModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType text/html "access plus 1 seconds" ExpiresByType image/gif "access plus 2592000 seconds" ExpiresByType image/jpeg "access plus 2592000 seconds" ExpiresByType image/png "access plus 2592000 seconds" ExpiresByType text/css "access plus 604800 seconds" ExpiresByType text/javascript "access plus 216000 seconds" ExpiresByType application/x-javascript "access plus 216000 seconds" </ifModule>
Code:<ifModule mod_headers.c> <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=2592000, public" </filesMatch> <filesMatch "\\.(css)$"> Header set Cache-Control "max-age=604800, public" </filesMatch> <filesMatch "\\.(js)$"> Header set Cache-Control "max-age=216000, private" </filesMatch> <filesMatch "\\.(xml|txt)$"> Header set Cache-Control "max-age=216000, public, must-revalidate" </filesMatch> <filesMatch "\\.(html|htm|php)$"> Header set Cache-Control "max-age=1, private, must-revalidate" </filesMatch> </ifModule>
To fix this you have to edit /jsmart/load.php file and change the block code
if (JSMART_CACHE_ENABLED) {
if (isset($headers['If-Modified-Since']) && $headers['If-Modified-Since'] == $mtimestr)
header_exit('304 Not Modified');
header("Last-Modified: " . $mtimestr);
header("Cache-Control: must-revalidate", false);
} else header_nocache();
Code:if (JSMART_CACHE_ENABLED) { if (isset($headers['If-Modified-Since']) && $headers['If-Modified-Since'] == $mtimestr) header_exit('304 Not Modified'); if ($file_type=='js') { header("Expires: " . gmdate("D, d M Y H:i:s", $mtime + 216000) . " GMT"); header("Cache-Control: max-age=216000, private, must-revalidate", true); } else { header("Expires: " . gmdate("D, d M Y H:i:s", $mtime + 604800) . " GMT"); header("Cache-Control: max-age=604800, public, must-revalidate", true); } } else header_nocache();
Resources
Some descriptions are based on .htaccess (Hypertext Access) Articles from AskApache.
mod_gzip settings are taken from Highub ? Web Development Blog.
Host Images FREE no delete
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
optimize my site
By kkrajdurai in forum Technical Help Desk SupportReplies: 12Last Post: 12th Jul 2012, 09:08 PM -
wp super cache VS w3 total cache
By kokosko in forum Webmaster DiscussionReplies: 1Last Post: 21st Dec 2011, 07:44 PM -
W3 cache plugin - breaks my site.
By BeitarJerusalem in forum WordpressReplies: 12Last Post: 12th Dec 2011, 01:23 PM -
How to speed up your site with GZIP
By cgworld in forum Tutorials and GuidesReplies: 20Last Post: 8th Mar 2011, 05:38 PM -
[Wordpress] WP Super Cache or W3 Total Cache ?
By Rocke in forum Polling PlazaReplies: 13Last Post: 13th Dec 2010, 06:00 PM
themaManager - edit and manage...
Version 4.19 released. Open older version (or...