Mobile app version of vmapp.org
Login or Join
Berryessa370

: Pre-gzipping files and serving to clients possible? I understand that we can do some settings in .htaccess to allow gzipping on the fly. However is there anyway we could do it "not-on-the-fly"?

@Berryessa370

Posted in: #Compression #Gzip

I understand that we can do some settings in .htaccess to allow gzipping on the fly.

However is there anyway we could do it "not-on-the-fly"?

I have a static file that I wish to serve gzipped, but I do not wish to do the gzipping on the fly (in other words pre-gzipped).

How would we go about doing it?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Berryessa370

1 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

Won't work with IE6 browsers, but here's how WordPress users do it.
perfectionlabstips.wordpress.com/2008/12/30/serving-gzipped-gz-files-as-compressed-css-javascript-html-content/
Their examples are for CSS and JavaScript, but it's easily applicable for .html from the samples.

They show you how to detect for browsers that won't work and keep an uncompressed copy and compressed copy side by side so your site will work with unsupportive browsers.

The following rule detects if the browser supports gzip, checks to see if you have a .gz file of the same name as the requested file and serves it instead of the uncompressed file:

RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ .gz [L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme