After digging deep into the sites and configuring my apache server ( after so many failures )
Here i came up with list of things to be done for
- Gziping the CSS/JS, image and flash files
- Removing Etags from CSS/JS and Image/flash files.
- Adding expires header to CSS/JS and image/flash files.
First, Go to your apache’s httpd.conf file
I my case its “C:\xampp\apache\conf\httpd.conf”
The lines beginning with # indicate that these are comments
Remove the comments for these below mentioned lines
LoadModule deflate_module modules/mod_deflate.so LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so
Add the below thing to remove the ETags. This can be added at the end
To Add expires header to all the files that are requested from the server
Note: Here “myProject” is the folder where my web pages are present. i.e “C:\xampp\htdocs\myProject”. Where “webResources” is the directory where my css, js, image, flash files are present. For all these files I am adding expires header of one day. Means these files can be can be cached for the entire day in the local browser. In other words these files are not changed at least for one day.
To Gzip the CSS and JS files that are present in the “webResources” folder
<Location "/sprintCommunity/webResources"> # Insert filter SetOutputFilter DEFLATE # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0 no-gzip # MSIE masquerades as Netscape, but it is fine # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 # the above regex won't work. You can use the following # workaround to get the desired effect: BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \ \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </Location>
Please post a comment if this was useful to you. Thanks