开发者

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

开发者 https://www.devze.com 2023-02-17 07:16 出处:网络
I am trying to implement HTTP compression in my APACHE 2.2 (OS: Linux centos). for I have got the following piece of code which needs to be updated in .htaccess from the following URL. But i do not k

I am trying to implement HTTP compression in my APACHE 2.2 (OS: Linux centos).

for I have got the following piece of code which needs to be updated in .htaccess from the following URL. But i do not know in which .htaccess file in APACHE(OS: Linux centos) server do i need to update. there are many .htaccess files in apache server. Please guide me.

Do i need to install or activate any module in apache server before adding the following code in the .htaccess file.

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

Com开发者_运维百科press everything except images:

<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> 


You can either add it to the .htaccess file in your DocumentRoot or better yet, add it to your httpd.conf file and restart the webserver.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号