.htaccess setting for more caching?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blakekr
    Member
    • Dec 2004
    • 30

    .htaccess setting for more caching?

    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.
  • -Oz-
    Senior Member
    • Mar 2004
    • 545

    #2
    i dont think so. if its php there is some sort of "program" called php cache, google for it.
    Dan Blomberg

    Comment

    • AndrewT
      Administrator
      • Mar 2004
      • 3653

      #3
      The server does not do any sort of HTTP, PHP, or MySQL caching. Only such a setting would exist in your browser.

      Comment

      • Buddha
        Senior Member
        • Mar 2004
        • 825

        #4
        Originally posted by blakekr
        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.
        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.
        "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

        Comment

        • mdmcginn
          Junior Member
          • Mar 2004
          • 22

          #5
          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

          • djn
            Senior Member
            • Mar 2004
            • 140

            #6
            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

            Working...