PageSpeed网站优化的麻烦 [英] PageSpeed site optimization trouble
问题描述
我有一个在我的网站列入COM pression一个问题。网站托管与Word $ P $ HTML的PSS和GZIP COM pression工作正常,即使没有在任何的.htaccess线或插件。但是JS / CSS的COM pression无法打开。香港专业教育学院尝试了很多不同的codeS,如:
I have a problem with the inclusion of compression on my website. Site hosted with WordPress and GZIP compression of HTML works fine even without any lines in the .htaccess or plug-ins. But the compression of JS/CSS does not turn on. Ive tried a lot of different codes, such as:
<IfModule mod_deflate.c>
<FilesMatch "\.(html|php|txt|xml|js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
或
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
或
# compress all text and html:
AddOutputFilterByType DEFLATE text/css application/javascript
或
# Or, compress certain file types by extension:
<Files *.css>
SetOutputFilter DEFLATE
</Files>
<Files *.js>
SetOutputFilter DEFLATE
</Files>
甚至在我的header.php:
or even in my header.php:
<?php ob_start("ob_gzhandler"); ?> //result - site crahes
和其他许多人......
and many others....
沟通与服务器管理员,包含更多的Apache的变质剂:mod_headers中,mod_filter和mod_expires,但COM pression仍然无法正常工作。我不明白为什么???而如何HTML的COM pression工程???
Communicated with the server administrator, included more apache modificators: mod_headers, mod_filter and mod_expires, but compression still does not work. I can not understand why??? And how compression of HTML works???
我的一些服务器的phpinfo()的:
Some of my server's phpinfo():
PHP Version 5.3.3-7+squeeze14
Apache Version Apache/2.2.16 (Debian)
Loaded Modules mod_deflate mod_expires mod_filter mod_headers mod_include mod_mime mod_rewrite etc...
HTTP_ACCEPT_ENCODING gzip,deflate,sdch
Accept-Encoding gzip,deflate,sdch
我试着用很多WP插件,如:W3的总缓存,GZIP力,WP HTTP COM pression,等...和...没有什么
I've tried to use a lot of WP plugins, such as: W3 Total Cache, Force GZIP, WP HTTP compression, etc... And... Nothing!
然后我试图COM preSS文件手动:style.css文件 - > style.css.gz -rename->的style.css -load到ftp和替换原来的。谷歌的PageSpeed说:已启用大!的COM pression!这里是你的测速点,但我的浏览器说:哪里是我的style.css,什么样的CR * P的吗? - 因为响应与style.css中没有恩codeD gsip头
Then I've tried to compress files manually: style.css -> style.css.gz -rename-> style.css -load to ftp and replace original. Google's PageSpeed says "Great! Compression enabled! Here is your speed points", but my browser says "Where is my style.css and what kind of cr*p is this?" - because response with style.css has no "encoded gsip" header.
谢谢提醒!
推荐答案
解决的办法很简单。问题是在Apache的配置:的AllowOverride
指令
The solution is quite simple. Problem is in apache configuration: AllowOverride
directive.
AllowOverride None
必须改成:
AllowOverride AuthConfig FileInfo
或只是
的AllowOverride全部
or just
AllowOverride All
然后,如果你想优化浏览器缓存
Then, if you want to optimize browser cache
利用浏览器缓存
和设置 ExpiresActive上
,配置httpd.conf来:
and set ExpiresActive on
, config your HTTPD.conf to:
AllowOverride AuthConfig FileInfo Indexes
或只是
的AllowOverride全部
or just
AllowOverride All
现在的问题是,将托管管理员帐户更改设置.....
The question is, will the hosting administrator account change the settings.....
这篇关于PageSpeed网站优化的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!