I would like to know if it is possible to configure apache to deliver files that are already gzipped on the filesystem.
I mention that I want apache to deliver these files using HTTP compression protocol.
If this is possible it should work like this: A file.txt.gz
is stored on the server and a client (supporting compression) makes a request for file file.txt
, the server would send the 开发者_StackOverflow中文版compressed file to the client.
According to the author of this page, you can serve your compressed files. First, add a type handler:
AddType "text/css;charset=UTF-8" .cssgz
AddEncoding gzip .cssgz
Then rewrite all requests for *.txt to *.txt.gz:
RewriteEngine on
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule (.*)\.txt$ $1\.txt.gz [L]
精彩评论