techolives7@gmail.com     +92 316 160 1973

How to Enable Text Compression and Reduce Page Size?

How to Enable Text Compression and Reduce Page Size

Text compression is an important part of page speed optimization, Google love those sites who are less in page size and efficient in their loading time. The worst thing is to reduce 500KB page size, Some genius install enable text compression wordpress plugins which actually helps in reducing text size but the plugin itself increase page size more than 1MB and risk website security too.

Once upon a time, I was also that kinda genius 🙂

If you don’t know how to check you page size and loading time them you can use multiple tools I prefer:

These tools also gives you details about things which you need to resolve and fix to reduce page size and speed.

So, If you are facing page speed loading time Issue and fed up of installing plugins and risking your website security then I can give you A quick solution which will help you to reduce your site loading time simply by copy-pasting a code into your .htaccess file.

Don’t get confuse with .htaccess file its not much development work.

Text Compression

  1. Login to your C Panel
  2. Go to File Manager
  3. Locate .htaccess file
  4. Locate htaccess file in File manager C panel

  5. Edit it
  6. Paste code
  7. How to insert text enable compression code

  8. Save it
  9. and here you go.

Text Compression Code for your .htaccess file.


# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

Thats it.

Its so simple still facing any issue comment below if you have any issue related to this post or any issue regarding Digital marketing.

Kudoos. Stay Positive and be Motivated.