Can someone provide me with an optimized .htaccess configuration that handles compression, browser caching, proxy caching, etc. for a typical website?
Aside from my visitors, I'm also trying to make Google PageSpeed happy. I wanna use caching and gzip compression through .htaccess please help me with its code!
I want to cache icon,pdf,flv,jpg,png,gif,js,css,swf
files for long time
I want to cache xml,txt
files for 2 Days
I want to cache html
files for 2 Days
And I wanna compress my html,txt,css,js,php
files because those have large file size.
Is there any way to gzip images using .htaccess?
Enable compression via .htaccess
For most people reading this, compression is enabled by adding some code to a file called .htaccess on their web host/server. This means going to the file manager (or wherever you go to add or upload files) on your webhost.
The .htaccess file controls many important things for your site. If you are not familiar with the .htaccess file, please read my working with .htaccess article to get some know how before changing it.
The code below should be added to your .htaccess file...
Save the .htaccess file and then refresh your webpage.
Check to see if your compression is working using the Gzip compression tool.
You should use following rule in your .htaccess file trust me it will increase minimum 10 points if you are not using this already.
Try this:
You can use the code as :-