Gzip sıkıştırmasını nasıl etkinleştiririm?


12

Bir Magento projesi için Gzip sıkıştırmasını ayarlamam gerekiyor. Projemdeki .htaccessdosyada birçok kod denedim , ancak Gzip'i etkinleştiremedim.

Lütfen bana doğru çözümü ver.


Site performansını artırmak için gzip sıkıştırmasından mı bahsediyorsunuz?
— Mukesh

evet, nasıl sıkıştırılacağını söyle?
— Kishan Kothari

Bu sorunu henüz çözdünüz mü ??
— Nitesh

Yanıtlar:


9

mod_deflateApache'de açık olduğundan emin olun . Bir info.phpdosya oluşturarak ve arayarak kontrol edebilirsiniz phpinfo();. Tarayıcıda PHP / Apache sunucularının çıktısını alır. İşiniz bittiğinde kaldırmayı unutmayın!

Ardından htaccessdosyanıza aşağıdakileri ekleyin

<IfModule mod_php5.c>
    ## enable resulting html compression
   php_flag zlib.output_compression on
</IfModule>

<IfModule mod_deflate.c>

    ## Force compression for mangled `Accept-Encoding` request headers
    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    ## Compress all output labeled with one of the following media types.
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE "application/atom+xml" \
                                      "application/javascript" \
                                      "application/json" \
                                      "application/ld+json" \
                                      "application/manifest+json" \
                                      "application/rdf+xml" \
                                      "application/rss+xml" \
                                      "application/schema+json" \
                                      "application/vnd.geo+json" \
                                      "application/vnd.ms-fontobject" \
                                      "application/x-font-ttf" \
                                      "application/x-javascript" \
                                      "application/x-web-app-manifest+json" \
                                      "application/xhtml+xml" \
                                      "application/xml" \
                                      "font/eot" \
                                      "font/opentype" \
                                      "image/bmp" \
                                      "image/svg+xml" \
                                      "image/vnd.microsoft.icon" \
                                      "image/x-icon" \
                                      "text/cache-manifest" \
                                      "text/css" \
                                      "text/html" \
                                      "text/javascript" \
                                      "text/plain" \
                                      "text/vcard" \
                                      "text/vnd.rim.location.xloc" \
                                      "text/vtt" \
                                      "text/x-component" \
                                      "text/x-cross-domain-policy" \
                                      "text/xml"

    </IfModule>

    ## Map the following filename extensions to the specified
    ## encoding type in order to make Apache serve the file types
    ## with the appropriate `Content-Encoding` response header
    ## (do note that this will NOT make Apache compress them!).
    <IfModule mod_mime.c>
        AddEncoding gzip              svgz
    </IfModule>

</IfModule>

merhaba zımpara kodu çalışmıyor. i bu kodu eklemek ama g.zip etkinleştiremezsiniz.
— Kishan Kothari

Sana yardım etmek için bundan biraz daha fazlasına ihtiyacım olacak. Herhangi bir hata veya ipucu çalışmıyor?
— Sander Mangel

web sitesi uygun bir iştir ama ben bu bağlantıdan checkgzipcompression.com kontrol G.zip göstermek daha etkin değil.
— Kishan Kothari

Mod_deflate'in açık olduğundan emin misiniz?
— Sander Mangel

evet, emin düğüm açık
— Kishan Kothari
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.