One URL to Rule them All, One URL to Find them, One URL to Bring them All and in the Web Bind them

If you read Tolkien's books you most likely will recognize the title of this blog post. It's about power. Absolute power. If you aim for high impact communication on the overloaded Internet, you better avoid being sandboxed by search engines because of duplicate links to essentially the same content. In addition, you don't want to confuse your audience in a spaghetti of URLs. Finally, duplication is hard to maintain anyway.

Fortunately there's a simple yet effective solution: the Global Redirect module.

In my previous blog post I introduced the Pathauto module. It allows you to create more meaningful URLs for the content your Drupal platform serves to its audience. However, we now end up with 2 valid URLs that point to the same content.

To get rid of the problem of having more than one link pointing to the same content, we will exploit the HTTP protocol through the Global Redirect module: whenever Drupal sees a Drupal internal URL for which we defined an URL alias (e.g., with the Pathauto module), Drupal will issue a HTTP 3xx server response to redirect the user to the created alias.

Installation of this module is straightforward: download the module from the Drupal repository, unpack the archive, and upload the “globalredirect” directory to your Drupal’s “sites/all/modules“ directory.

Once installed, enable the module via admin/build/modules. Version 6-x-1.2 requires you to run update.php after enabling the module, as there seems to be a required database update that is not handled by the install script. After this step you are done. I use the default settings for Global Redirect. If you want to check the settings, go to “admin/settings/globalredirect”.

If you wondered why the URLs to my blog posts have changed, you now know why {#emotions_dlg.grin}.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.