在.htaccess或php.ini中你如何用gzip? [英] How do you use gzip in .htaccess or php.ini?

查看:147
本文介绍了在.htaccess或php.ini中你如何用gzip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在找一个简单的一行code,将使用gzip COM preSS的CSS,HTML,JS和PHP文件的Web服务器上。我怎样才能做到这一点的.htaccess文件或php.ini文件? (我的CSS和JS文件都在单独的文件夹的根目录)

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)

推荐答案

你最有可能寻找的 Apache中 mod_deflate模块模块。启用它在你的的httpd.conf ,也启用了.htaccess,然后在你的.htaccess下DOCUMENT_ROOT添加此code:

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>

这篇关于在.htaccess或php.ini中你如何用gzip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆