Answer the question
In order to leave comments, you need to log in
Why can't I properly serve a file compressed with gzencode()?
There are a bunch of html files, completely static. I want to compress all of them using gzencode () and then directly give it to the user. And with direct feedback, the plug comes out. I prescribe the directive in .htaccess: Header set Content-Encoding: gzip
In the browser I see that the desired header is given to me, but decoding does not occur.
And at the same time, here is the code:
$content = file_get_contents('./test.shtml');
$content = gzencode($content, 9);
header('content-encoding: gzip');
echo $content;
$content = file_get_contents('./test.shtml');
$content = gzencode($content, 9);
file_put_contents('./test_gz.shtml', $content);
Answer the question
In order to leave comments, you need to log in
In general, I figured it out myself. The method I needed did not want to work only with the shtml extension, apparently some kind of muddled with SSI.
apache itself can do this - httpd.apache.org/docs/2.2/mod/mod_deflate.html. why any extra movement?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question