There should be a way to configure the server so that if files “foo” and “foo.gz” exist, then “foo.gz” gets served if “Accept-Encoding: gzip” is specified in the request, and otherwise foo gets served. All of this with proper negotiation, “Varies” header, handling of “;q=0”, and so on. http://httpd.apache.org/docs/2.4/mod/mod_deflate.html#precompressed is a workaround, but doing content negotiation using mod_rewrite is hardly a proper solution. The key point here is the fact that the MultiViews option only has an effect if the named file does not exist as such. https://github.com/apache/httpd/blob/fbc5e20ead005fd3a2bec05924f9e90dfd195406/modules/mappers/mod_negotiation.c#L3081-L3082 One solution might be a way to enforce MultiViews even if the file exists. Such a setting could be either for specific files, or for all files. Or perhaps depending on some environment variable. If you can't agree to this, then another (less comfortable) solution would be implementing special handling of the identity encoding. That way, users could store files “foo.id” and “foo.gz”, could “AddEncoding identity .id”, the absence of “foo” itself would trigger MultiViews, and the negotiation code would know to fall back to the “identity” version if it couldn't find a better fit. Having to rename all files would be annoying, but it's still better than the mod_rewrite hack, I think. I realize that you might consider type-map files the best (i.e. most performant) solution. But I think generating the appropriate type maps is far more work than renaming a bunch of files, so I hope for a simpler alternative. There are a number of discussions of this issue on Stack Exchange: http://stackoverflow.com/q/75482/1468366 http://stackoverflow.com/q/9076752/1468366 http://stackoverflow.com/q/16883241/1468366 http://serverfault.com/q/131452/129921 So I would say this is a common enough problem. Many of the options suggest adding “MultiViews” and “AddEncoding”, despite the fact that this doesn't work as intended (and judging from the age of the relevant line it never did work).
> One solution might be a way to enforce MultiViews even if the file exists. > Such a setting could be either for specific files, or for all files. Or > perhaps depending on some environment variable. FWIW I think this would be reasonable