PageSpeed Insights not seeing the Gzip compression

前端 未结 6 628
轮回少年
轮回少年 2021-02-05 11:01

I\'m trying to speed up my website. Google insights (https://developers.google.com/speed/pagespeed/insights) tells me that a critical problem is to enable GZip compression.

6条回答
  •  轮回少年
    2021-02-05 11:29

    For anyone who may be having an "Uncompressed Pages" issue after running a SEMRush site audit, try adding the following to your .htaccess

    
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html|txt|css|js|php)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_Gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    
    

    Always remember to backup your .htaccess file before making any edits, as a simple typing error could cause certain features of your website to fail or even worse - break your entire website.

    Reference: https://www.semrush.com/blog/improve-page-load-times-htaccess-file/

提交回复
热议问题