Site Speed Optimization Using .htaccess

A letter to the developer..

Hi,

Here I’m sharing two of many recommendations from Google (http://developers.google.com/speed/pagespeed/insights/) for improving site’s performance – enabling “gzip compression” and “browser caching”.

My query – do you thing that updating “.htaccess” file with the following lines of code will be helpful?

# BEGIN Deflate

<IfModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript

</IfModule>

# END Deflate

# BEGIN Expires

<IfModule mod_expires.c>

# Enable expirations

ExpiresActive On

# Default directive

ExpiresDefault “access plus 1 month”

# My favicon

ExpiresByType image/x-icon “access plus 1 year”

# Images

ExpiresByType image/gif “access plus 1 month”

ExpiresByType image/png “access plus 1 month”

ExpiresByType image/jpg “access plus 1 month”

ExpiresByType image/jpeg “access plus 1 month”

# CSS

ExpiresByType text/css “access 1 month”

# Javascript

ExpiresByType application/javascript “access plus 1 year”

# PDF

ExpiresByType application/pdf “access 1 month”

</IfModule>

# END Expires

This code will enable “gzip compression” for text, HTML, XML, JavaScript, and CSS files (files that are residing within the same server – files from different domains may not under our control). It will also leverage “browser caching” for images, CSS, javascript, and PDFs.

This is just a suggestion and since you’ve more technical expertise with “.htaccess” operations, so ignore if the above will have not much impact on improving performance or alternate solutions are already in place.

Note: “access plus 1 year” or “access 1 month” is just hypothetical terms and we can modify them (like “access 2 months” or “access plus 15 days”) as per our own requirements.

Regards,

Speedy SEO Gonzales 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s