Post by grooverdan » Wed Sep 08, 2010 10:51 pm

These directives control non-dynamic content. The index.php is unaffected by this.

This is my first cut a cache-optimisation. Feel free to comment on enhancements.

deflate here is simple. Compress if the server has that module and the client claims to support it.

Etags, Expire and Cache-Control are specified in RFC2616 and provide hints as to when the client need not request the same URL again. Etags allows the client to submit 'request if changed' GET request.

Cache-Control public allows the content to be cached even on a SSL connection by the client. This hasn't got security implications as the static images are public anyway. Cache-Control public also permits proxies to share the caching between a number of users.

Top level .htaccess file

Code: Select all

ETag MTime

<IfModule mod_deflate.c>
        SetOutputFilter DEFLATE
</IfModule> 

<IfModule mod_headers.c>
        # replace 'append' with 'merge' for Apache version 2.2.9 and later
        Header append Cache-Control public env=!NO_CACHE
</IfModule>
<IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access plus 1 month"
</IfModule>
A before and after picture of http://store.ironsidemilitary.com.au looking at the YSlow Firefox plugin.
668K before and 271K after. Seems my hosting provider is doing etags by default hence the untuned case looks good. I haven't worked out why the primed cache is larger in the second case.
untuned.png

Before .htaccess file - untuned.png (35.82 KiB) Viewed 3308 times

tuned.png

With .htaccess - tuned.png (35.46 KiB) Viewed 3308 times


New member

Posts

Joined
Sun Jul 04, 2010 9:08 am
Who is online

Users browsing this forum: No registered users and 9 guests