Looking at the page, in Chrome's Network tab, it looks like it's being served with type text/javascript
. Try adding that to your filter.
mod_deflate not compressing js in wordpress site
-
26-06-2022 - |
Question
I'm working on a wordpress site. I enabled mod_deflate with this command in .htaccess:
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css
application/x-javascript application/javascript
but if i test with GTMetrix: http://gtmetrix.com/reports/watchesstock.eu/wd4jvMpZ
it gives me this advice:
Enable gzip compression "Compressing the following resources with gzip could reduce their transfer size by 229.8KiB (68% reduction)."
and then a list of .js files
Could anyone help me? Thanks
Solution
OTHER TIPS
The answer by Hobo seems like it should work, but it doesn't for me. I suspect it's because of the version strings on the end of the .js URLs.
I ended up adding:
<Files ~ "\.(htm|html|css|js|php)$">
SetOutputFilter DEFLATE
</Files>
This does work for me.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow