Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 为(siteground主机)指定Vary:Accept编码头_Wordpress_.htaccess - Fatal编程技术网

Wordpress 为(siteground主机)指定Vary:Accept编码头

Wordpress 为(siteground主机)指定Vary:Accept编码头,wordpress,.htaccess,Wordpress,.htaccess,这是我的.htaccess文件,我使用谷歌的超级缓存插件和pagespeed # TN - START EXPIRES CACHING # ExpiresActive On ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" Ex

这是我的.htaccess文件,我使用谷歌的超级缓存插件和pagespeed

# TN - START EXPIRES CACHING #
ExpiresActive On
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"
# TN - END EXPIRES CACHING #

# TN - BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
# TN - END Cache-Control Headers

# TN - BEGIN Turn ETags Off
FileETag None
# TN - END Turn ETags Off

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

# BEGIN supercache
<IfModule mod_mime.c>
  <FilesMatch "\.html\.gz$">
    ForceType text/html
    FileETag None
  </FilesMatch>
  AddEncoding gzip .gz
  AddType text/html .gz
</IfModule>
<IfModule mod_deflate.c>
  SetEnvIfNoCase Request_URI \.gz$ no-gzip
</IfModule>
<IfModule mod_headers.c>
  Header set Vary "Accept-Encoding, Cookie"
  Header set Cache-Control 'max-age=3, must-revalidate'
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html A3
</IfModule>
Options -Indexes
# END supercache

Options All -Indexes
#TN-启动缓存过期#
过期于
ExpiresByType文本/css“访问1个月”
ExpiresByType text/html“访问1个月”
ExpiresByType image/gif“访问1年”
过期按类型图像/png“访问1年”
过期按类型映像/jpg“访问1年”
过期按类型图像/jpeg“访问1年”
过期按类型图像/x图标“访问1年”
过期按类型应用程序/pdf“访问1个月”
ExpiresByType应用程序/javascript“访问1个月”
ExpiresByType文本/x-javascript“访问1个月”
过期按类型应用程序/x-shockwave-flash“访问1个月”
ExpiresDefault“访问1个月”
#TN-结束缓存过期#
#TN-开始缓存控制头
标头集缓存控制“公共”
标头集缓存控制“公共”
标头集缓存控制“专用”
标题集缓存控制“专用,必须重新验证”
#TN-结束缓存控制头
#TN-开始关闭ETags
FileTag无
#TN-结束关闭ETags
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
#开始超级缓存
ForceType文本/html
FileTag无
AddEncoding gzip.gz
AddType text/html.gz
setEnvifLocase请求\u URI\.gz$no gzip
标题集“接受编码,Cookie”
标头集缓存控制“最大年龄=3,必须重新验证”
过期于
ExpiresByType文本/html A3
选项-索引
#端超缓存
选项所有-索引
如果我停用cdn,我会在速度测试中出错:

以下可公开缓存、可压缩的资源应具有“Vary:Accept Encoding”标头: ... asonry.js,qver==4.2.1.pagespeed.jc.aJe1qC-NMI.js ttps://droidawy.com/wp-content,主题,艺术。。。t、 min.js,qver==1.11.4.pagespeed.jc.vbnvncv-.js ... css,qver=1.4.12.pagespeed.cf.bcGmYWboif.css ttps://droidawy.com/wp-content/plugins/mh-auth ... css,qver=1.3.1.pagespeed.cf.sg490QkEIx.css ... css,qver=2.1.1.pagespeed.cf.IEZBYGhsBU.css ttps://droidawy.com/wp-content/plugins/mh-maga ... style.css,qver=2.0.1.pagespeed.cf.k8FUittoKh.css 包括/js/jquery/jquery.js,qver=1.12.4.pagespeed.jm.ppcpakkss.js

我试过这个代码,但没有解决:

<IfModule mod_headers.c>
  <FilesMatch ".(js|css|xml|gz|html)$">
    Header append Vary: Accept-Encoding
  </FilesMatch>
</IfModule>

头附加变量:接受编码

SiteGround的超级缓存插件(通常)不需要对.htaccess文件进行任何修改

删除.htaccess中的超级缓存项,然后重新启用CDN,清除CDN缓存,然后重试

在一个备注中,考虑使用谷歌浏览器的审计选项卡来检查您的站点的速度,因为许多在线工具正在对您的主机进行假设,但这不是真的。特别是,许多工具都是针对HTTP/1.1服务器的,而SiteGround提供HTTP/2(在交付内容时,这是一个完全不同的范例)


祝你好运。

SiteGround的超级缓存插件(通常)不需要对.htaccess文件进行任何修改

删除.htaccess中的超级缓存项,然后重新启用CDN,清除CDN缓存,然后重试

在一个备注中,考虑使用谷歌浏览器的审计选项卡来检查您的站点的速度,因为许多在线工具正在对您的主机进行假设,但这不是真的。特别是,许多工具都是针对HTTP/1.1服务器的,而SiteGround提供HTTP/2(在交付内容时,这是一个完全不同的范例)


祝你好运。

谢谢你提供的宝贵信息,但我使用pagespeed停用siteground缓存,我使用wp super cache插件,因此我必须编辑。htaccess当我停用Cloudflare CDN时,我觉得我的站点速度更好。还有其他想法吗?我非常肯定siteground有自己的名为SuperCacher(或类似的东西)的插件。你能检查一下你的账户上是否有?在专用服务器上,可通过cPanel访问。请在这里告诉我。在那里告诉我,但当我使用pagespeed时,它会自动停用,所以我使用pagespeed和wp super cache+htaccess利用浏览器缓存是的,我想我的“答案”并不是真正的答案,因为我建议你放弃GPS和wp super cache,以交换SiteGround自己的超级缓存插件。SG还提供静态缓存(就在GPS选项上方)。祝你好运。谢谢你提供的宝贵信息,但我使用pagespeed停用siteground缓存,我使用wp super cache插件,所以我必须编辑。htaccess当我停用Cloudflare CDN时,我觉得我的网站速度更好。还有其他想法吗?我非常确定siteground有自己的名为SuperCacher(或类似的东西)的插件。你能检查一下你的账户上是否有?在专用服务器上,可通过cPanel访问。请在这里告诉我。在那里告诉我,但当我使用pagespeed时,它会自动停用,所以我使用pagespeed和wp super cache+htaccess利用浏览器缓存是的,我想我的“答案”并不是真正的答案,因为我建议你放弃GPS和wp super cache,以交换SiteGround自己的超级缓存插件。SG还提供静态缓存(就在GPS选项上方)。祝你好运