I tried running the production version of my react-app on Apache server but I realised it is not using gzip compression. I have no idea how to do it. I tried researching on the web ad found that I need to update the .htaccess file for it but I can't locate it even with hidden files enabled.The same JS file had a size of around 100KB on React's server but it shows up as 400KB on Apache's server.
Asked
Active
Viewed 296 times
2 Answers
0
You should create it by yourself inside of document root and than add directives inside of it. For example:
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
Check more on Apache website.

Elvis Plesky
- 3,190
- 1
- 12
- 21