Page Speed Optimization

As of September 15, 2015, Page Speed Optimization has been removed from the DreamHost Panel. It can manually be installed on a Dedicated server, but is no longer supported by DreamHost.

It is not available for use on a VPS as sudo/admin/root access is not available.

Page Speed Optimization is a feature that reduces website loading times by automatically optimizing web pages and the resources within them. Under the hood of this feature is an Apache module that Google developed called mod_pagespeed.

How does it work?

Page Speed Optimization dynamically adjusts the filenames of site resources, adding information about how 'old' the item is. It uses these age calculations to instruct visitor's browsers to serve cached copies of resources instead of requesting new copies. This cuts down on the number of requests to the server, which improves site speed in two ways:

  • when a visitor can use a cached version of a resource instead of requesting a new copy, there is no need for the visitor to wait for the request to be sent to the server and then wait for the server to send the resource back to their browser.
  • with the server serving less resource requests, it has more resources to jump on the requests it does receive, so those requests can potentially be filled in less time.

How can I tell if it's working?

Once you have manually installed Page Speed Optimization, go to your website and browse around a bit. Resources that are on multiple web pages, such as a header graphic, have a filename like originalFileName.gif.pagespeed.ce.9-w9vHbyfP.gif. The originalFileName.gif is what you named it when you uploaded it to the web server. All the extra stuff (.pagespeed.ce.9-w9vHbyfP.gif) is added by Page Speed Optimization.

What if my page images get rewritten?

If an image with a name like "Åsen.jpg" gets rewritten by Page Speed Optimization (note the special character), try renaming it to "Aasen.jpg".

How long does it take for my edits to update?

If you've made edits to your site when Page Speed Optimization is active, you may not see these updates until 5 to 10 minutes later. DreamHost recommends that you disable this feature when updating a live site. This way your changes appear immediately. Once complete, you can then re-enable.

How can I clear the PageSpeed cache?

If you have a Dedicated server, and you are an admin user, you can run:

[server]$ sudo touch /var/mod_pagespeed/cache.flush

Customizations

Page Speed Optimization has a lot of additional filters which you can use to minify even further by means of custom code in an .htaccess file. You can read more about these filters on Google's site here:

Here's an example:

<IfModule pagespeed_module>
    ModPagespeed on
    ModPagespeedEnableFilters remove_comments,rewrite_javascript,rewrite_css,rewrite_images
    ModPagespeedEnableFilters elide_attributes,defer_javascript,move_css_to_head
    ModPagespeedJpegRecompressionQuality -1
</IfModule>

Below is further information about the filters used in the above example:

If you add multiple options, they can be on one line separated by commas. But do not use spaces. For example:

ModPagespeedEnableFilters remove_comments,move_css_to_head

Using Page Speed with WordPress

Using PageSpeed with WP Super Cache

WP Super Cache works excellently with Google PageSpeed. If you're using Google PageSpeed, you don't need to use a minification plugin as you can use PageSpeed to do that instead.

General WordPress optimization

Unless you're using nginx, you can use Google PageSpeed on your site to help optimize it further. Just by turning it on, it minifies your webpage. That means it takes your formatted source code and gets rid of the extra spaces you don’t use. This is called by using the PageSpeed filter “collapse_whitespace”.

There are many filters you can add to your site by editing your .htaccess file. You simply need to include a section like this:

<IfModule pagespeed_module>
     ModPagespeed on
     ModPagespeedEnableFilters remove_comments,rewrite_javascript,rewrite_css,rewrite_images
     ModPagespeedEnableFilters elide_attributes,defer_javascript,move_css_to_head
     ModPagespeedJpegRecompressionQuality -1
</IfModule>

You'll want to experiment with what works best for your site. View the following link for further details:

PageSpeed with DreamPress

Page Speed Optimization is not available with DreamPress.

See also