I got a better solution from a website called
http://wordpresspartner.com/tutorials/godaddy-htaccess-gzip/
The solution:
This solution is tested by only wordpress as per the owner.
This solution to speeding up your Godaddy hosted Website has 4 actions:
- Create a PHP file to compress CSS
- Create a PHP file to compress JavaScript
- Save the two new PHP files to the root of your Website
- Add entries to your Website .htaccess file to run the two compression scripts and cache images (including ico images).
Here are more detailed instructions:
1. Create a PHP file to compress CSS
Create a file called compress-css.php (this is likely best created in a text editor such as Notepad or Notepad++) and save it on your local computer. Copy and paste the following into compress-css.php:
<?
ob_start("ob_gzhandler");
header("content-type: text/css; charset: UTF-8");
header ("expires: " . gmdate ("D, d M Y H:i:s", time() + 302400) . " GMT");
header("Cache-Control: max-age=302400, public, must-revalidate", true);
echo "/*n";
echo "Generated by www.wordpresspartner.comn";
echo "*/n";
echo file_get_contents($_GET['file']);
?>
2. Create a PHP file to compress JavaScript
Create a file called compress-js.php (this is likely best created in a text editor such as Notepad or Notepad++) and save it on your local computer. Copy and paste the following into compress-js.php:
<?
ob_start(“ob_gzhandler”);
header(“content-type: text/javascript; charset: UTF-8″);
header (“expires: ” . gmdate (“D, d M Y H:i:s”, time() + 302400) . ” GMT”);
header(“Cache-Control: max-age=302400, private, must-revalidate”, true);
echo “/*n”;
echo “Generated by www.wordpresspartner.comn”;
echo “*/n”;
echo file_get_contents($_GET['file']);
?>
3. Save the two new PHP files to the root of your Website
Copy compress-css.php and compress-js.php to the root of your Website (this is usually achieved via FTP).
4. Add entries to your Website .htaccess file to run the two compression scripts and cache images
Add the following to the end of the .htaccess file (usually at the root of your Website). If a file named .htaccess doesn’t exist then create a file named .htaccess in a text editor, add the text below and then transfer to the root of your Site.
# BEGIN Compression and Caching Script per http://wordpresspartner.com
# This calls the ‘compress-css.php’ and ‘compress-js.php’ files
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*.(css))$ compress-css.php?file=$1
RewriteRule ^(.*.(js))$ compress-js.php?file=$1
</ifModule>
# This enables caching
<ifModule mod_headers.c>
<filesMatch “\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$”>
Header set Cache-Control “max-age=2592000, public”
</filesMatch>
<filesMatch “\.(xml|txt)$”>
Header set Cache-Control “max-age=216000, public, must-revalidate”
</filesMatch>
<filesMatch “\.(html|htm|php)$”>
Header set Cache-Control “max-age=1, private, must-revalidate”
</filesMatch>
</ifModule>
# End Compression Script