Global Redirect

nicholasThompson - October 7, 2006 - 23:37
Global Redirect Logo

What?

GlobalRedirect is a simple module which…

  1. Checks the current URL for an alias and does a 301 redirect to it if it is not being used.
  2. Checks the current URL for a trailing slash, removes it if present and repeats check 1 with the new request.
  3. Checks if the current URL is the same as the site_frontpage and redirects to the frontpage if there is a match.
  4. Checks if the Clean URLs feature is enabled and then checks the current URL is being accessed using the clean method rather than the 'unclean' method. (Currently only in DEV, will be in 1.3 soon)

Why?

Once enabled, an alias provides a nice clean URL for a path on a site. However Drupal does not remove the old path (eg node/1234). The problem is that you now have two URLs representing the same content. This is dangerous territory for duplicate pages which can get you sandboxed by the search engines!

How?

This module uses hook_init to interrupt the page load and the a alias lookups. If any of the above rules apply then the appropriate action is taken. If no rules apply then the page load continues uninterrupted. An example of this in use is on the site it was developed for. http://www.sportbusiness.com/node/160559 will redirect to http://www.sportbusiness.com/news/160559/lagardere-sets-up-sports-division due to the alias setup on this site.

Anything I Should Know?

As with most modules - there are often a few things you should be aware of before going ahead.

  • Version 1.2 has been released. This includes some code improvements and better compliance with coding standards.
  • Known Bugs:
    • Broken under 4.7.4, but works under later 4.7 releases. The issue is explained on node 89600, comment 13 and is caused by path.inc not returning aliases correctly. Thanks to RayZ for finding the problem
    • Issues with Windows IIS Server. There is a known issue with Clean URL's in IIS and there is also a known issue with certain versions of PHP running on IIS where a Permanent Redirect (301) is incorrectly sent as Object Moved (302).

Releases

Official releasesDateSizeLinksStatus
5.x-1.22007-Dec-287.4 KBRecommended for 5.xThis is currently the recommended release for 5.x.
4.7.x-1.2-12007-Apr-266.47 KBRecommended for 4.7.xThis is currently the recommended release for 4.7.x.
Development snapshotsDateSizeLinksStatus
6.x-1.x-dev2007-Dec-307.5 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
5.x-1.x-dev2008-Jan-037.84 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
4.7.x-1.x-dev2007-Apr-276.47 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
 
 

Drupal is a registered trademark of Dries Buytaert.