I'd like add compression to my website. However, after doing some preliminary research, I have come out being more confused than when I started.
I have a specific set of requirements:
1. The method must work with Apache 2. This rules out mod_gzip for my shared servers setup.
2. The server must not compress the file each time it is requested. This is extremely wasteful and most of my content is static. It appears mod_gzip has the ability to do this, but due to requirement one I cannot do use it. mod_deflate does not appear to be able to do this (and its compression level is specifically set lower by default to compensate)
3. The compression must be done in a cross-browser compatible way to ensure minimal breakage if a browser is known not to handle gzipped content correctly. It appears this document would be helpful in implementing this. Also, a previous forum member has posted on this topic and mentioned a specific set of mod_rewrite rules that are a very practical implementation of the rules.
From these three requirements, it looks like I will have to forgo any compression module and hand-compress the files myself, in a manner similar to Arawn's solution. I'd like to field the question to you guys, however, if there is a better way (i.e. needs less work) of achieving the same functionality?
Adding compression to Apache
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
with mod_rewrite you could test if compressed content available and, if not, redirect request to some php script that would both send compressed content to the client and store compressed version, so subsequent requests would forego php completely.
I believe something like this is used in Symfony framework where they cache html output to .html files
I believe something like this is used in Symfony framework where they cache html output to .html files
Last edited by Weirdan on Sun Jun 17, 2007 3:44 pm, edited 1 time in total.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US