簡體   English   中英

我需要在APACHE(OS:Linux centos)服務器中的哪個.htaccess文件中進行更新

[英]In which .htaccess file in APACHE(OS: Linux centos) server do i need to update

我正在嘗試在APACHE 2.2(操作系統:Linux centos)中實現HTTP壓縮。

因為我有以下代碼需要通過以下URL在.htaccess中進行更新。 但是我不知道我需要更新APACHE(OS:Linux centos)服務器中的哪個.htaccess文件。 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> 

您可以將其添加到DocumentRoot的.htaccess文件中,也可以將其添加到httpd.conf文件中,然后重新啟動Web服務器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM