简体   繁体   English

Mod_Deflate和GoDaddy问题

[英]Mod_Deflate and GoDaddy issues

I use the following quip on a htaccess file to enable compression on a GoDaddy server; 我在htaccess文件上使用以下技巧来在GoDaddy服务器上启用压缩;

####################
# GZIP COMPRESSION #
####################
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip

This is a quip I've taken from another question on StackOverflow a long time ago. 这是我很久以前从StackOverflow上的另一个问题中获得的一个讽刺。 Up until recently this worked perfectly. 直到最近,这一切仍然完美。 Now it simply refuses to work, despite mod_deflate being enabled on WHM, websites like https://checkgzipcompression.com/ will tell me that the website isn't compressed. 现在,尽管在WHM上启用了mod_deflate,但它只是拒绝工作,像https://checkgzipcompression.com/的网站会告诉我该网站未压缩。 I cannot enable compression on this server unless I use ob_gzhandler in PHP as follows; 除非按如下方式在PHP中使用ob_gzhandler,否则无法在此服务器上启用压缩;

if(!ob_start("ob_gzhandler")) ob_start();

This isn't an optimal solution. 这不是最佳解决方案。

I have a VPS on which I have a fairly similar apache/php installation, and it hosts the same version of the website hosted on the GoDaddy server, having the exact same files, including the htaccess with the gzip compression quip, and it works without requiring ob_gzhandler. 我有一个VPS,上面安装了相当类似的apache / php,它托管GoDaddy服务器上托管的网站的相同版本,具有完全相同的文件,包括带有gzip压缩quip的htaccess,并且无需需要ob_gzhandler。

I've tried contacting GoDaddy, but they have been most unhelpful telling me to "verify the htaccess" instead of doing anything, and I've considered migrating my entire installation to another service provider. 我曾尝试与GoDaddy联系,但他们对我说“验证htaccess”而不是做任何事最无济于事,并且我考虑将整个安装迁移到另一个服务提供商。

Is there anything extra I should verify? 还有什么我需要验证的吗?

Login to WHM -> Account Information ->List Accounts . 登录到WHM -> Account Information ->List Accounts Click on the CP icon for that account (the one with the desired website). 单击该帐户的CP图标(具有所需网站的帐户)。 Once you are in cPanel search for Optimize Website . 进入cPanel后,搜索Optimize Website

By default the Gzip compression is disabled. 默认情况下,禁用Gzip压缩。

Enable it for all the content or just for specific content. 为所有内容或仅针对特定内容启用它。 Then re-check your website on https://checkgzipcompression.com/ and it should show you that the gzip compression is enabled. 然后在https://checkgzipcompression.com/上重新检查您的网站,它应该显示gzip压缩已启用。

Then you can use the desired htaccess rules for mod_deflate. 然后,您可以将所需的htaccess规则用于mod_deflate。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM