I have a configuration that doesn't seem too common on the Internets (PHP with IIS), and so far I have not been able to find a solution for my problem because of this.
Basically when I'm sending a manual 404 header on my php page:
header('HTTP/1.0 404 Not Found');
The problem is that I then always get encoding errors, which I've determined has something to do with gzip being enabled.
When I curl with --compressed I get:
HTTP/1.1 404 Not Found
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 3560
Content-Type: text/html
Content-Encoding: gzip
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Vary: Accept-Encoding
Server: Microsof开发者_如何学Got-IIS/6.0
Set-Cookie: PHPSESSID=b0ueqhtc3o4p7m2luqss170fr3; path=/
Date: Mon, 11 Jul 2011 16:15:40 GMT
curl: (61) Error while processing content unencoding: invalid code lengths set
Is it possible to disable compression just for this one page? Or is there some other solution for this that I'm missing? I don't want to disable compression for the entire site.
This is simple, just use the ini set like so:
<?php
if(ini_get('zlib.output_compression')){
ini_set('zlib.output_compression', 'Off');
}
header('HTTP/1.0 404 Not Found');
?>
Simple as that.
精彩评论