Sending a Drupal Site Into Retirement

Ideas for how to gracefully retire (or semi-retire) a Drupal site.

Note: This article was originally published on May 15, 2014. We are republishing this article (with updates) as the first in a series detailing why and how to retire a Drupal site. Comments from the original will appear unmodified.

Drupal is a great tool for creating a website. It has a lot of modules and functionality that enable building interesting and complex features, but sometimes those sites lose their relevancy. However, there are several types of sites that might be repurposed from active Drupal sites to static sites:

  • A site for an event that has passed where event information and session summaries should remain available but no longer actively require maintenance.
  • A site that is infrequently or never updated, where the work of maintaining the site takes more time than the site is worth.
  • A site that will never be migrated from an older version of Drupal because the next version of the site will start with a clean slate. If old content is still relevant and should be archived, the original content can be preserved as static pages while creating new, different pages in a new Drupal instance.
  • A sub-section of a site that won’t be updated anymore, especially if the sub-section has a distinctive theme or layout that is no longer needed, and doesn’t have to match the rest of the site. 

Where to Host a Static Site

When transforming a Drupal site to a static site, a decision needs to be made as to where to host it. A cheap or free option for hosting is great, especially if the purpose of this project is just to preserve the site’s content without doing any more work on it. One nice option is to use Github Pages, to host a Jekyll or static site for free. 

Preparing to Go Static

There is some preparation necessary for converting any dynamic Drupal site into a static site.

Update Views

  • Remove ajax functionality.
  • Remove all exposed views filters.
  • Remove clickable table column headers.
  • Edit views to remove pagination where possible to avoid the need to deal with static paginated results. Display all results wherever possible.
  • Edit views fields and remove links to content that won’t be available in the static site. 

Other Changes

  • Switch to a non-javascript theme.
  • Remove login and user blocks.
  • Turn on JS and CSS aggregation.
  • Disable and remove all forms.
  • Remove the search form and turn search off.
  • Turn off comment options on all content types, close new comments on all existing content.
  • Remove links to unwanted pages in the static site, like links to authors. 
  • Update formatters to remove “link to content” options if that linked content in the static site are not needed.
  • Edit permissions and make sure anonymous user permissions reflect exactly what’s desired in the static site. Examine permissions for things like the ability to add comments or content or view messages.
  • If including an XML sitemap, the sitemap needs to be copied from the generating site, followed by a copy/replace to change the base URL of the sitemap to the URL of the static site.

One final task is to make sure no error messages will appear in my static content. The following was found in page.tpl.php on a Drupal 7 site and removed while spidering the site: 

<?php print $messages; ?>

Finally, review the site as an anonymous user to see if there are any other elements that aren’t accessible or won't work if Drupal is not actively running in the background.

See https://www.drupal.org/node/27882 for more ideas.

Think About Links

One of the biggest problems of transforming a dynamic site into static pages is that the URLs must change. The 'real'URL of a Drupal page is index.php?q=news, or index.php?q=/about, i.e., there is only one HTML page that dynamically re-renders itself depending on the requested path. A static site has to have one HTML page for every page of the site, so the new URL has to be something like /news.html or /news/index.html

Since URLs must change, internal links still need to work. Those internal links are still going to look like /news. One way to check the links is to use Apache’s mod_rewrite to redirect requests for patterns like /news to /news.html. Anotheroption is relying on the default behavior of many servers to automatically redirect a request for /news to /news/index.html.

A Tale of Two Sites

In these scenarios, a current Drupal site will become the source for a second, new, static, site. The Drupal site could be retired once the static site is created or preserved to create future iterations of the static site. If there’s a need to preserve it, the original Drupal site could move behind a VPN or into some other protected location to simply serve as a place for editors to make later updates and for administrators to generate future static versions of the site.

Creating a Static Site

Now that the site is ready, there are several ways to actually create a static version of the site. Watch for more articles that will explore several specific ways to accomplish this.

Get in touch with us

Tell us about your project or drop us a line. We'd love to hear from you!