XAMPP 開啟Gzip壓縮(windows)

XAMPP 開啟Gzip壓縮(windows)

想要讓使用者瀏覽你的網頁更快,除了平常優化外,可以試試Gzip網頁壓縮。

編輯httpd.conf,將#去掉
LoadModule headers_module modules/mod_deflate.so
LoadModule filter_module modules/mod_filter.so

編輯php.ini
zlib.output_compression = On

編輯.htaccess

<IfModule mod_deflate.c>
# Insert filters
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
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml

# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

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

重啟Apache

檢測網站:

http://checkgzipcompression.com/
http://gzip.zzbaike.com/
http://www.whatsmyip.org/http-compression-test/

分享...XAMPP 開啟Gzip壓縮(windows)0XAMPP 開啟Gzip壓縮(windows)0
0 回復

發表評論

想要留言嗎?
歡迎歡迎!

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *