我有一个URL如下www.example.com/fr_FR
curl返回types如下:
HTTP/1.1 200 OK Date: Mon, 16 Oct 2017 10:35:19 GMT Server: Apache Set-Cookie: PHPSESSID=img4385scm6ldm6vngtntsrou1; path=/; HttpOnly Cache-Control: no-cache Set-Cookie: FirstVisit=1; expires=Wed, 18-Oct-2017 10:35:20 GMT; Max-Age=172800; path=/; httponly Cache-Control: no-cache Content-Type: text/html; charset=UTF-8
我的.htaccess
包含以下指令:
<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript application/rss+xml application/xml application/xhtml+xml application/x-font-ttf application/x-font-opentype image/svg+xml </IfModule>
问题是,特定的URL没有被gzip,但是,如果我访问.html
文件,或者如果我直接在我的apache虚拟主机添加AddOutputFilterByType DEFLATE text/html
gzip工作:
Content-Encoding: gzip
有关我的虚拟主机AllowOverride
中的信息设置为All
。
URL /fr_FR
有什么问题,为什么即使Content-Type
是text/html
,它也不会被gziped?
UPDATE1:
有关信息,我的网站是一个symfony2网站
apache docs( http://httpd.apache.org/docs/2.2/mod/core.html#addoutputfilterbytype )表明AddOutputFilterByType在某些情况下可能会部分或完全失败。 另外这个指令在apache2.1及更高版本中被弃用。 既然你说的.html作品,你可以尝试:
AddType text/html .html