.htaccess for Caching and GZip

Custom / NA
December 9, 2009 at 19:47:02
Specs: Windows 7, 3.5GB Ram
I'm hosting my website on a 1&1 Linux server. I want to speed up my site a bit, so I'm using the following in my .htaccess:

<FilesMatch "\.(ico|flv|jpg|jpeg|png|gif|swf|css|js)$">
Header unset ETag
FileETag None
Header set Cache-Control "public, no-transform, must-revalidate"
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"

My first question, will this appropriately cause my images, css, etc to be cached until it is changed? I want to avoid having to rename files to cause them to be re-cached, so I added the "must-revalidate". Will this work?

Second question, I have GZip compression enabled in the PHP.ini file for all PHP files, but I would also like to compress js/css files (since mine are large). I've tried quite a few different commands to the .htaccess file, but all fail or cause server 500 errors. I don't know if I'm doing it wrong, or if 1&1 doesn't have Apache setup the right way (for what I am trying to do). So, what should I use in the .htaccess file to cause js/css files to be compressed?

-Ryan Adams

Free Computer Tips and more:http://RyanTAdams.com
Paid Tech Support: Black Diamond

See More: .htaccess for Caching and GZip

Report •

January 7, 2010 at 12:10:55
i think ur hosting company is not supporting mod_gzip use this !

php_value output_handler ob_gzhandler

also read this, it might help you:


(you need to edit your header file in theme folder)

Report •
Related Solutions

Ask Question