I'm looking for a simple one line code that will use gzip to compress css, html, js, and php files on the web server. How can I do this with the .htaccess file or php.ini file? (My css and js files are in seperate folders in the root directory)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You're most likely looking for mod_deflate module in Apache. Enable it in your httpd.conf
and also enable .htaccess then add this code in your .htaccess under DOCUMENT_ROOT:
<FilesMatch "\\.(js|css|html|htm|php)$">
SetOutputFilter DEFLATE
</FilesMatch>
回答2:
<Files *>
#Compress
SetOutputFilter GZIP
</Files>