Speed Up Pligg Loading Times By Using htaccess Rules
Posted on 21. Jan, 2010 by Stuart in Pligg Hacks
Users are always on a quest for speedier loading times on their Pligg based websites and one of the easiest ways you can achieve this is by adding Header Expire rules and Gzip rules to your .htaccess file. Before you try these techniques make a backup of your .htaccess file as you hosting environment may not support all of the techniques in this article.
1. Enable Caching
The code snippet below will tell web browsers to cache files with the extension x for x amount of time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # 1 YEAR Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" Header unset Last-Modified # 2 HOURS Header set Cache-Control "max-age=7200, must-revalidate" # CACHED FOREVER # MOD_REWRITE TO RENAME EVERY CHANGE Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2011 20:00:00 GMT" Header unset Last-Modified |
2. Gzip Files
Gzip allows you to compress files, so obviously that means they load faster. The code below will gzip html, text, css, js and php files:
1 2 3 4 5 6 7 8 9 10 | <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </ifModule> |
3. Combine Gzip And Caching
Combining the two tips above, gzip and caching, the code below is a brilliant snippet from SAMUEL SANTOS site:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # BEGIN Compress text files <IfModule mod_deflate.c> <FilesMatch "\.(css|js|x?html?|php)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> # END Compress text files # BEGIN Expire headers <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType image/x-icon "access plus 2592000 seconds" ExpiresByType image/jpeg "access plus 2592000 seconds" ExpiresByType image/png "access plus 2592000 seconds" ExpiresByType image/gif "access plus 2592000 seconds" ExpiresByType application/x-shockwave-flash "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" ExpiresByType text/html "access plus 600 seconds" ExpiresByType application/xhtml+xml "access plus 600 seconds" </IfModule> # END Expire headers # BEGIN Cache-Control Headers <IfModule mod_headers.c> <FilesMatch "\\.(ico|jpe?g|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 "\\.(x?html?|php)$"> Header set Cache-Control "max-age=600, private, must-revalidate" </FilesMatch> </IfModule> # END Cache-Control Headers # BEGIN Turn ETags Off <IfModule mod_headers.c> Header unset ETag </IfModule> FileETag None # END Turn ETags Off # BEGIN Remove Last-Modified Header <IfModule mod_headers.c> Header unset Last-Modified </IfModule> # END Remove Last-Modified Header |
Give these techniques a try and see some speed improvements when browsing your Pligg site, let us know how you get one and leave any feedback.

Tried it on http://www.faqpal.com seems to have made a difference, thanks for the snippet.
Good to hear, you can never have too many optimization techniques to keep your user experience as zippy as possible.