AFAIK you can't do it automatically.
This will work though.
Compress all the files first.
- Login to shell
- Change the working directory to that of the files
- Run the command 'gzip -r *.js *.css'
Now edit .htaccess
- You can use nano if you are still in the shell -
a. nano ~/domain/.htaccess
b. When done press Ctrl-O and press enter to save, then press Ctrl-X to exit
- Add the lines below:
# For files already compressed using gzip
AddEncoding gzip .gz
...and if you need to uncompress a file the command is 'gzip -d filename.gz' or 'gunzip filename.gz' (the uncompressed file will replace the compressed file)