How to increase WordPress website Speed Using .htaccess?

How to increase WordPress website Speed Using .htaccess?

Team Leader Asked on February 11, 2017 in WORDPRESS.
Add Comment
1 Answer(s)

1.Gzip compression:

Every response of the server sends may be gzipped or compressed before it is sent to the visitors. Gzip compression helps to reduce the amount of data that send to users and speeds up the loading time of the website.
Add the code in your .htaccess file:


<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>


2.Serving scaled images & Optimize images

3.Avoid CSS @import & Minify JavaScript

4.Avoid landing page redirects

5.Set Expires and Cache-Control headers:
If you want to add browser caching in your website, you will need to set the time when the cache expires.

<ifModule mod_expires.c>

ExpiresActive On

ExpiresDefault "access plus 10 seconds"

ExpiresByType image/x-icon "access plus 5184000 seconds"

ExpiresByType image/jpeg "access plus 5184000 seconds"

ExpiresByType image/png "access plus 5184000 seconds"

ExpiresByType image/gif "access plus 5184000 seconds"

ExpiresByType application/x-shockwave-flash "access plus 5184000 seconds"

ExpiresByType text/css "access plus 5184000 seconds"

ExpiresByType text/javascript "access plus 5184000 seconds"

ExpiresByType application/javascript "access plus 5184000 seconds"

ExpiresByType application/x-javascript "access plus 5184000 seconds"

ExpiresByType text/html "access plus 1200 seconds"

ExpiresByType application/xhtml+xml "access plus 1200 seconds"

</ifModule>

Team Leader Answered on February 25, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.