Optimizing pagespeed


#1

Hello!

I checked my site with Google Pagespeed. It states two high priority issues which I’m trying to follow.

  1. activate compression
  2. Setting an expiry date or a maximum age in the HTTP headers for static resources

For 1: I tried to use mod_deflate and added the following lines to .htaccess

<FilesMatch “\.(js|css|html|xml)$”>
SetOutputFilter DEFLATE

Even after a restart Pagespeed is still saying that the content like css/js files which are locally loaded is not compressed. At least phpinfo is showing mod_deflate - so the module should be available.

For 2: I googled and found mod_expires which I like to use with the following .htaccess entries

ExpiresActive On
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon “access plus 1 year”

Any chance to get mod_expires on the Shared Webserver? It seems that this module is missing - at least I do not see it with phpinfo.

Any tipps are more than welcome


#2

This works on my machine.

Files already compressed with gzip can be served given the file does not store the original name and time stamp information. You don’t have to modify your HTML either:
Add to .htaccess:

[code]

The browser will decompress the content

AddEncoding gzip .gz

Serve gzip compressed file if available and acceptable

RewriteEngine on RewriteCond %{HTTP:accept-encoding} gzip RewriteCond %{REQUEST_FILENAME} !^.+\.gz$ RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.+) $1.gz [L] [/code]

Use gzip from the shell:
[machine]$ gzip -n stylesheet.css
[machine]$ ls
stylesheet.css.gz

Example #1: fetch http://openvein.org/styles/screen.css.gz
Example #2: fetch http://openvein.org/styles/screen.css

(credit this thread)


#3

Hi!

Doing the compression manualy is not I was looking for. I have no an automatic solution running - this compresses on the fly the files.

SetOutputFilter DEFLATE

Cheers