Speed Up Your WordPress Site with .htaccess and GZIP

Adding these lines to your .htaccess file can dramatically speed up content delivery.

By Nathan Ingram   |  March 2, 2015

In a recent iThemes Training webinar, I explained the importance of adding several lines to the .htaccess file that will instruct your web server to deliver content that has been deflated by GZIP rather than sending it uncompressed by default.

Warning: making changes to the .htaccess file can create major problems for your website. You should know what you’re doing before you attempt these additions.

Here is the code that was mentioned:

[sourcecode language=”php”]
<IfModule deflate_module>
<IfModule filter_module>
AddOutputFilterByType DEFLATE text/plain text/html
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
</IfModule>
</IfModule>
[/sourcecode]

In most cases, this simple addition should speed up your website. Also, if you host multiple sites on the same server, making this change once in the root directory should make the change apply to all subfolders/subsites as well.

Related posts:

Comments

Leave a Reply