Drupal page caching


  • Drupal 5.x (patched 6.x version available)
  • Apache webserver (to customize .htaccess)
  • Clean URLs

Tested on

  • Drupal 5.x

Drupal page caching can be achieved using some contrib modules. I choose Boost, available for drupal 5.x and 6.x (only a 5.x patched version is now available).

According to installation instructions, query pages are not cached. Since default pagination rely on query (e.g. frontpage?page=2 to display the third page of home page view “frontpage”) you have to found a way to “clean” that URLs if you want to cache them.

A module named Clean Pagination (Drupal 5.x only) do the magic (result for example above: frontpage/2) and now even specified pages can be cached.

To test the module, open two different browser or session as anonymous user. Then, visit your paged page (e.g. frontpage/2) with the first browser (A), then go to the same page as anonymous with the other (B). (B) version of the page now should display an HTML comment inserted by Boost like:

<!– Page cached by Boost at 2008-09-30 09:59:14, expires at 2008-09-30 10:59:14 –>

Note: remember that (A) should not show any HTML comment on first visit. The “main” page cache (e.g. frontpage) if it was cached too before clean pagination will display the original pager instead the clean one until page cache expire (customizable on admin/settings/performance).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: