Skip to main content
3 of 3
added 100 characters in body
Jimajamma
  • 17.1k
  • 1
  • 28
  • 35

If you want to do this yourself, quick and dirty, it would be something like this:

function yourmodule_init() {

  $foo=drupal_get_path_alias($_GET['q']);
  $bar=explode('/',$foo);

  if ($bar[0]=='this-string-to-redirect') {
    $bar[0]='redirect-me-here';
  }

  $baz=implode('/',$bar);

  drupal_goto($baz);

}

You might also want/need to throw in a weight of -1 to make sure your module runs early by putting:

function yourmodule_install() {
  db_query('UPDATE {system} SET weight = -1 WHERE name = "yourmodule"');
}

in yourmodule.install but a quick look just now shows globalredirect's weight at the default of 0 so this may be unneeded.

Jimajamma
  • 17.1k
  • 1
  • 28
  • 35