Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.1k views
in Q2A Core by
edited by
can anyone share .htaccess code to enable gzip? I am using donut theme
Q2A version: 1.7
by
What do you mean? Gzip code for doing what?
by
I mean .htaccess coding to enable gzip & compress data because bootstrap has so many unused classes & lines

2 Answers

+2 votes
by
 
Best answer

I am Answering Myself..

I found this code. Place this code in your .htaccess & it will speed up your site little bit. I hope this will help someone, Thank You.

# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP

0 votes
by
edited by
# CACHING
<IfModule mod_expires.c>
    ExpiresActive On
    # ExpiresDefault     "access plus 2 days"
    
    ExpiresByType text/css     "access plus 1 month"
    ExpiresByType text/javascript             "access plus 1 month"
    ExpiresByType application/javascript     "access plus 1 month"
    ExpiresByType application/x-javascript     "access plus 1 month"
    
    ExpiresByType image/ico         "access plus 1 month"
    ExpiresByType image/x-icon         "access plus 1 month"
    ExpiresByType image/gif         "access plus 1 month"
    ExpiresByType image/jpg         "access plus 1 month"
    ExpiresByType image/jpeg         "access plus 1 month"
    ExpiresByType image/png         "access plus 1 month"
    ExpiresByType image/svg+xml     "access plus 1 month"
    ExpiresByType application/x-shockwave-flash     "access plus 1 month"
    ExpiresByType video/mp4         "access plus 1 month"
    ExpiresByType video/ogg         "access plus 1 month"
    ExpiresByType video/webm         "access plus 1 month"
</IfModule>

# GZIP for js, css and html
<IfModule mod_deflate.c>
  <FilesMatch "\.(js|css|html)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>
by
why you are using caching PNG twice (    ExpiresByType image/png         "access plus 1 month" )?
And also on my site users are not allowed to upload any video just youtube videos are shown & I think those are just thumbnails and just shockwave/flash so can I remove  these 3 lines
    ExpiresByType video/mp4         "access plus 1 month"
    ExpiresByType video/ogg         "access plus 1 month"
    ExpiresByType video/webm         "access plus 1 month"
by
Thanks good catch. And yes, you can delete any type you like / don't need.
...