+91-943-185-6038 me@shashidharkumar.com

How to increase my website speed through .htaccess in LAMP Technology

Many LAMP(Linux Apache MySQL PHP) driven websites today could easily decrease their bandwidth output and increase their speed through implementing caching and compressing their content. Even with the new high speed connections of today it is still highly important to improve websites efficiency and performance to increase the users experiences. This article goes over will decrease your bandwidth output. Lets get to increasing the performance efficiency of your website with my experience, I have faced in many years in this industry as LAMP Technology Developer.

Write down the following code in .htaccess file located at root folder of your domain. If you don’t find the file at your root folder as the same above than you can create as the same (i.e. .htaccess) without any extension.

<IfModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/plain text/html text/css text/xml text/javascript

BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4.0[678] no-gzip

BrowserMatch bMSIE !no-gzip !gzip-only-text/html

</IfModule>

# Sets the cache control for 1 week

<FilesMatch “.(css|jpg|png|gif|swf|js)$”>

Header set Cache-Control “max-age=604800, must-revalidate”

</FilesMatch>

# turn on the module for this directory

ExpiresActive on

# set default

ExpiresDefault “access plus 24 hours”

ExpiresByType image/jpg “access plus 1 months”

ExpiresByType image/gif “access plus 1 months”

ExpiresByType image/jpeg “access plus 1 months”

ExpiresByType image/png “access plus 1 months”

ExpiresByType text/css “access plus 1 months”

ExpiresByType text/javascript “access plus 1 months”

ExpiresByType application/javascript “access plus 1 months”

ExpiresByType application/x-shockwave-flash “access plus 1 months”

See also  How to change the XAMPP server port number