I realize this is a really vague question, but is there something I can put in my .htaccess to enable more caching for my static pages? Since I've moved a data-heavy site over here, it seems like it's reloading from scratch everytime I pull up a page.
.htaccess setting for more caching?
Collapse
X
-
Are your static pages extension .HTML? PHP files, of course, load the PHP engine (or at least initialize the environment) and therefore are slower even if they are only static HTML. Just my 2 cents.Originally posted by blakekrI realize this is a really vague question, but is there something I can put in my .htaccess to enable more caching for my static pages? Since I've moved a data-heavy site over here, it seems like it's reloading from scratch everytime I pull up a page."Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - BuddhaComment
-
Here's a good Sitepoint article about Caching with PHP/MySQL
Gzipping is not caching, but it can help performance. I put these lines in my php.ini file:
Code:zlib.output_compression = ON; zlib.output_compression_level = 1;
Comment
-
There is a way indeed to send cache-related http headers to the client. This is what I use for static images and stuff that doesn't change often: just add text/html for your web pages to be cached (client-side). Values are in seconds from last access; look the Apache docs for more options (http://httpd.apache.org/docs/1.3/mod/mod_expires.html)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A18000
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType text/x-component A7776000
ExpiresByType text/css A604800
ExpiresByType text/javascript A604800
</IfModule>Comment
Comment