apache_conf htaccess Gzip

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf htaccess Gzip相关的知识,希望对你有一定的参考价值。

# http://socreativedigital.com/7-htaccess-file-examples-that-work-for-seo-2013-05-04
# An issue that was bought up by SEOquake and Nibbler was that my webpage’s
# were not compressed with Gzip.
#
# Gzip is compression and decompression SERVER SOFTWARE that compresses your
# webpage when visited, therefore enabling your webpage to load faster in the
# visitors browser. Htaccess has some code which you can put in the htaccess
# file that initiates gzip when the visitors browser looks to see if the web
# page has gzip compression.
#
# Most website hosts have this software on their servers, and serve the websites
# hosted by them already compressed so you don’t have to worry, some have the
# software installed but you have to activate it via the htaccess file. There
# are websites which can check this for you just Google “gzip testing”.
#
# Mine was the latter and after entering the code, to my growing htaccess file,
# hey presto! lakanephotography.co.uk was compressed. And the gzip code for the
# htaccess file:
#
# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
#
# This code compresses my HTML CSS website including XML RSS and JavaScript.
# The # denotes a comment in the same way you comment a HTML or CSS document.
# It covers the main applications of my website, but I have no doubt, if you was
# to research a bit further then there will be more code to which you can add to
# this, to cover other applications like PHP ect.

以上是关于apache_conf htaccess Gzip的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf gzip压缩.htaccess

apache_conf .htaccess Gzip压缩

apache_conf htaccess中的gzip压缩

apache_conf 启用GZIP压缩(.htaccess)

apache_conf .htaccess gzip + chache

apache_conf htaccess的:gzip的