I have configured cache expiration and gzip compression in .htaccess file but its not working according to yslow chrome extension stats.
Here is my .htaccess
# ----------------------------------------------------------------------
# Mod Rewrite
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# ----------------------------------------------------------------------
# gZip Compression
# ----------------------------------------------------------------------
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
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>
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
<IfModule mod_expires.c>
ExpiresActive on
# Your document html
ExpiresByType text/html "access plus 0 seconds"
# Media: images, video, audio
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# CSS and JavaScript
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
</IfModule>
Note: I'm using Xampp
This is my first post here!
For cache expiration:
Did you check if the module "mod_expires.so" is enabled in apache/conf/httpd.conf? Search for the line
#LoadModule expires_module modules/mod_expires.so
and remove the "#" sign. After that it should work.For gzip compression:
I use "mod_deflate" to enable compression. I also use "mod_mime", "mod_setenvif" and "mod_headers". Check each be enabled in httpd.conf. This combination works for me.
Htaccess my compression:
More information here. I hope that helps.