HTACCESS Wrappers with PHP - The same basic...
(Page 4 of 9 )
The same basic formula can be applied again for other uses -- HTTP compression, for example. This was an idea that used to be impractical because computers ran at slower speeds, and is now obsolete because of broadband technologies (DSL and cable).
It works like this: when an HTML page is loaded, the web server instead gives the visitor a zipped or compressed version of that page. The visitor downloads that file, which of course takes up less space than the real thing and downloads in less time, then unzips it and displays the original page.
In this age of lighting fast DSL lines, there's almost no noticeable difference. However, if you have a site that hosts large files whose audience is mostly dialup users, it might be something to look into.
Make a new folder called "compress". Create your htaccess file again, just as before, but set the extensions to include .htm, .html, and .txt. (The group name, folder name, and script name have nothing to do with one another, you can name any of these whatever you like -- I just like things to match.)
Our wrapper script for this should be called "compress.php". That's what I'm naming mine. This means the htaccess file you have should look as follows:
AddHandler compress .html
AddHandler compress .htm
AddHandler compress .txt
Action compress /compress/compress.php
More Web Development Articles
More By 359