Compression - how to enable?

Status
Not open for further replies.

ntsite

Member
Messages
135
Reaction score
1
Points
18
Hello.

I have two sections of website - one subdomain with wordpress and another relatively simple no database required html5. In Wordpress there is compression working - compression checker websites says it. But my html5 webpage is without compression. I searched for some codes but couldn't find any working solutions.

In previous posts I have seen some posts where it is noted that X10hosting has Gzip by default, but while testing it shows Gzip is not enabled.
How to configure this in .htaccess?
 

lylex10h

Active Member
Messages
982
Reaction score
71
Points
28
Try the following code:

Code:
<IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.presentation application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf application/vnd.ms-opentype audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>

<IfModule mod_deflate.c>
    #The following line is enough for .js and .css
    AddOutputFilter DEFLATE js css woff

    #The following line also enables compression by file content type, for the following list of Content-Types:
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml text/javascript application/javascript

    #The following lines are to avoid bugs with some browsers
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
 

ntsite

Member
Messages
135
Reaction score
1
Points
18
Hello. Thank you I tried - it works. Had some worries about whether will it work together with rewrite based code, and it worked :)
 
Status
Not open for further replies.
Top