Lesser-Known Drupal Tweaks

Dev

Lesser-Known Drupal Tweaks

by Josh Varner
//

We’re speed freaks here at InterWorks. We’re only happy when our sites, software, systems and networks go fast. I mean Ricky Bobby fast. And on the web team, we don’t just do it for the thrills. Site optimization can affect your server’s performance, as well as your site’s reputation and search engine rankings.

Drupal, the popular and powerful content management system, doesn’t always like to go fast. Even relatively simple installations, when misconfigured, can chew up server resources and leave your site crawling. Today I’d like to write about a few lesser-known Drupal tweaks you can try, which can improve performance and have a positive impact on your site’s SEO.

Restrict Access to Drupal’s Cron

Your server should be the only host that can visit the cron.php script at the base of your Drupal installation. This script, usually ran automatically every hour by your server’s cron daemon, can cause page caches to be purged and site maps to be rebuilt, among other things. If outside hosts are able to run this script, they can cause these tasks to run prematurely, causing unnecessary load.

If you’re using Apache, and you have mod_rewrite loaded and enabled, you can use something similar to the following in your Apache configuration to restrict access:

RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
RewriteRule ^/?cron.php - [F,L]

Check Your XML Site Map

A common module for Drupal installations is the XML Sitemap module. It generates a site map that’s easily consumed by search engine crawlers, such as Googlebot. If you’re currently using the 6.x-1.x branch of the module, I strongly suggest upgrading to the 6.x-2.x branch. Search engines are constantly visiting the site map, and there are instances where 6.x-1.x will fail to properly cache a previously-generated sitemap.xml file, causing it to regenerate the file each time. This can have drastic performance implications. On the very site you’re visiting, a single sitemap.xml generation with 6.x-1.x can cause 70,000 queries to MySQL.

Updating the XML Sitemap module is simple:

  1. Get the latest recommended release of the 6.x-2.x branch from the XML Sitemap project page
  2. Upload the new version to your server
  3. Run Drupal’s update.php twice
  4. Visit your Permissions page and grant yourself the XML Sitemap administration permission
  5. Visit the XML Sitemap configuration page and follow the instructions
  6. High-five the nearest person

Quicktabs and Crawlers Don’t Mix

If you’re using the Quicktabs module, you should prevent search engine crawlers from indexing the links it adds to your site’s HTML. These links don’t actually do anything (they’re overridden using JavaScript), but they clutter the URL list generated by crawlers with unnecessary duplicates. These duplicates can also add unnecessary load to your server. Here’s an easy configuration snippet you can use for Apache and mod_rewrite:

RewriteCond %{QUERY_STRING} ^(.*)quicktabs_(.*)$
RewriteRule ^/?(.*)$ /$1? [R=301,L]

More About the Author

Josh Varner

Database Engineer
Proper Care and Feeding of Vertica (Part One) (This is a multi-part series about the proper care & feeding of a Vertica cluster. There’s simply too much content for one post, ...
Big Changes in Vertica 6.1 SP2 (6.1.2) About a month ago, HP Vertica released its latest service pack, HP Vertica 6.1 Service Pack 2 (version 6.1.2). It may sound like a ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072

×

Love our blog? You should see our emails. Sign up for our newsletter!