doudeng3008 2016-05-31 09:31
浏览 52

Google Speed Insights未检测到mod_deflate

I try to get a higher score for Google Speed Insights. But I have some troubles with the mod_deflate. It is active on the server and I insert the code in the htaccess file. Please see below. However, Google does not detect it. It did a test on www.whatsmyip.org/http-compression-test and there it works fine. I tried also to leave the if tags. But still same issue. What I is wrong?

RewriteEngine On

# If you install pulse in a sub-folder, some hosts require 
# RewriteBase to be set to that sub-folder name (below)

# RewriteBase /subfolder/


############################################################
# RewriteRules for using Pulse with your own template
############################################################ 

# Uncomment the rules below if you are using your own template
# If embedding to a page other than blog.php, edit that in the rules below

# RewriteRule ^blog-page-([^-]*)$ blog.php?page=$1                            
# RewriteRule ^blog-([^-]*)+? blog.php?d=$1 [L]


#############################################################
# RewriteRules for using the Pulse template engine
#############################################################

# If you want to place the blog on a url other than /blog, 
# change the word "blog" in p=blog to the new url in both rules below

RewriteRule ^blog-page-([^-]*)$ ?page=$1&p=blog [L]
RewriteRule ^blog-([^-]*)+? ?d=$1&p=blog [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?p=$1 [L]


# RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]



# Deflate Compression by FileType
<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/xml
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/atom_xml
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/x-shockwave-flash
</IfModule>

# BEGIN Expires-Headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 8 hours"
ExpiresByType text/html "access plus 8 hours"
ExpiresByType application/xhtml+xml "access plus 8 hours"
ExpiresByType image/jpg "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/x-icon "access plus 30 days"
ExpiresByType application/x-shockwave-flash "access plus 30 days"
ExpiresByType text/css "access plus 30 days"
ExpiresByType text/javascript "access plus 30 days"
ExpiresByType application/x-javascript "access plus 30 days"
</IfModule>
# END Expires-Headers
  • 写回答

1条回答 默认 最新

  • dongxin1999 2016-06-14 23:23
    关注

    mmm i have my .htaccess:

    This is the web im working now: 100 speed Mobile & Desktop, 100 UX

    https://developers.google.com/speed/pagespeed/insights/?url=hotelpuebloupala.com&tab=mobile

    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom_xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-shockwave-flash
    </IfModule>
    
    # turns cache on for 1 month
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType text/html "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType application/xhtml-xml "access plus 600 seconds"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 month"
    </IfModule>
    
    <ifmodule mod_headers.c>
    <filesmatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
    </filesmatch>
    
    <filesmatch "\.(css)$">
    Header set Cache-Control "max-age=604800, public"
    </filesmatch>
    
    <filesmatch "\.(js)$">
    Header set Cache-Control "private, max-age=604800"
    </filesmatch>
    
    <filesmatch "\.(x?html?|php)$">
    Header set Cache-Control "max-age=600, private, must-revalidate"
    </filesmatch>
    
    </ifmodule>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题