2011-03-16 74 views
0

我試圖在我的APACHE 2.2(OS:Linux centos)中實現HTTP壓縮。其中.htaccess文件在APACHE(OS:Linux centos)服務器上是否需要更新

因爲我已經得到了以下一段代碼,它需要在以下URL的.htaccess中進行更新。但是我不知道在哪個.htaccess文件中需要更新APACHE(操作系統:Linux centos)服務器。在Apache服務器中有很多.htaccess文件。請指導我。

是否需要在.htaccess文件中添加以下代碼之前,先安裝或激活apache服務器中的任何模塊。

http://www.askapache.com/htaccess/apache-speed-compression.html

除了圖像

壓縮一切:

<Location /> 
# Insert filter 
SetOutputFilter DEFLATE 

# Netscape 4.x has some problems... 
BrowserMatch ^Mozilla/4 gzip-only-text/html 

# Netscape 4.06-4.08 have some more problems 
BrowserMatch ^Mozilla/4\.0[678] no-gzip 

# MSIE masquerades as Netscape, but it is fine 
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
# Don't compress images 
SetEnvIfNoCase Request_URI \ 
\.(?:gif|jpe?g|png)$ no-gzip dont-vary 

# Make sure proxies don't deliver the wrong content 
Header append Vary User-Agent env=!dont-vary 
</Location> 

回答

1

您可以將其添加到.htaccess文件在你的DocumentRoot或更好,但它添加到你的httpd.conf文件並重新啓動網絡服務器。