mod_gzip and mod_deflate are not currently loaded on the free hosts. Instead, you can pass the files you wish to compress through a script. For example:
Code:
<IfModule !mod_gzip.c>
RewriteCond %{HTTP:Accept-Encoding} (^|,)gzip|deflate(,|$)
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.*\.(html|js|css))$ /compress?u=/$1 [NS]
</IfModule>
compress.php:
PHP Code:
<?php
if ($_GET['u'][0] != '/') {
$_GET['u'][0] = '/' . $_GET['u'][0];
}
// check that $_GET['u'] is safe to dump. For example:
$path = realpath(DOCUMENT_ROOT . $_GET['u']);
if (strpos($path, DOCUMENT_ROOT . '/') !== 0) {
header('HTTP/1.0 404 Not Found');
exit();
}
// you'd also need to implement HTTP authorization if you have any resources on your site that are protected by it.
if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
if (preg_match('/(^|,)\s*gzip\s*(,|$)/', $_SERVER['HTTP_ACCEPT_ENCODING'])) {
ob_start('ob_gzhandler');
} else if (preg_match('/(^|,)\s*deflate\s*(,|$)/', $_SERVER['HTTP_ACCEPT_ENCODING'])) {
if (function_exists('ob_deflatehandler')) {
ob_start('ob_deflatehandler');
} else {
$path = "php://filter/read=zlib.deflate/resource=$path";
}
}
}
readfile($path);
To configure Finder to show dotfiles, use:
Code:
defaults write com.apple.Finder AppleShowAllFiles YES
You'll need to restart the Finder to see the change. You can do this with an applescript such as frogstomp's or the following:
Code:
set showFiles to ""
try
set showFiles to do shell script ¬
"defaults read com.apple.finder AppleShowAllFiles"
end try
set dfltBtn to 1
ignoring case
if {showFiles} is in {"ON", "TRUE", "1"} then
set dlgMsg to "Hidden Files (currently shown) ..."
set dfltBtn to 2
else if {showFiles} is in {"OFF", "FALSE", "0"} then
set dlgMsg to "Hidden Files (currently hidden) ..."
else
set dlgMsg to "Hidden Files..."
end if
display dialog dlgMsg buttons {"Show", "Hide", "Cancel"} ¬
default button dfltBtn
copy the result as list to {buttonpressed}
try
set restartFinder to 1
if the buttonpressed is "Hide" then
do shell script ¬
"defaults write com.apple.finder AppleShowAllFiles FALSE"
else if the buttonpressed is "Show" then
do shell script ¬
"defaults write com.apple.finder AppleShowAllFiles TRUE"
else if the buttonpressed is "Cancel" then
set restartFinder to 0
end if
end try
end ignoring
if restartFinder is 1 then
tell application "Finder" to quit
delay 1
tell application "Finder" to launch
end if