Pages

Speeding up Your Web Site
Following on from some experiments with Page Speed and YSlow plugins for Fire Fox I have modded my .htaccess file to include the following
Briefly what happens is slight_js.php now gets gzipped
all js and css files get gzipped before delivery
all gif,jpg,png,js,css and ico files get a long expiry date which means the browser caches them
When moving from page to page there are some considerable time savings.
Next job is to minify the javascript and css files in the theme and in plugins. Then we'll look at the order of delivering the js and moving as much as possible to the end of the page rather than the footer
RewriteEngine on
FileETag none
<FilesMatch "sleight_js.php$">SetOutputFilter DEFLATE
ExpiresActive on
ExpiresDefault "access plus 2 months"
</FilesMatch><FilesMatch "\\.(js|css)$">SetOutputFilter DEFLATE
</FilesMatch><FilesMatch "\.(gif|jpg|png|js|css|ico)$">ExpiresActive on
ExpiresDefault "access plus 2 months"
</FilesMatch>
Briefly what happens is slight_js.php now gets gzipped
all js and css files get gzipped before delivery
all gif,jpg,png,js,css and ico files get a long expiry date which means the browser caches them
When moving from page to page there are some considerable time savings.
Next job is to minify the javascript and css files in the theme and in plugins. Then we'll look at the order of delivering the js and moving as much as possible to the end of the page rather than the footer
Author : Father Barry
Created : 24 Dec 09 : 11:32 Last Updated : 24 Dec 09 : 11:26
Views : 985 Unique Views : 450










Comments
Hi Barry,
Copied this and pasted into my .htaccess file, but I got 500 internal server error and in the log was <FilesMatch> was not closed.
I played about with the code above and seems happier with the code below. I think the problem may have been an extra \ in the js|css line.
Cool stuff - it does make a difference, no doubt useful for bandwidth too!
Mike
RewriteEngine on
FileETag none
<FilesMatch "sleight_js.php$">
SetOutputFilter DEFLATE
ExpiresActive on ExpiresDefault "access plus 2 months"
</FilesMatch>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
<FilesMatch "\.(gif|jpg|png|js|css|ico)$">
ExpiresActive on ExpiresDefault "access plus 2 months"
</FilesMatch>
Reply to this
[ Posted by 02 Jan 10 : 16:29 ]
Copied this and pasted into my .htaccess file, but I got 500 internal server error and in the log was <FilesMatch> was not closed.
I played about with the code above and seems happier with the code below. I think the problem may have been an extra \ in the js|css line.
Cool stuff - it does make a difference, no doubt useful for bandwidth too!
Mike
RewriteEngine on
FileETag none
<FilesMatch "sleight_js.php$">
SetOutputFilter DEFLATE
ExpiresActive on ExpiresDefault "access plus 2 months"
</FilesMatch>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
<FilesMatch "\.(gif|jpg|png|js|css|ico)$">
ExpiresActive on ExpiresDefault "access plus 2 months"
</FilesMatch>
Reply to this
[ Posted by 02 Jan 10 : 16:29 ]

