Index: globalredirect.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/globalredirect/globalredirect.module,v retrieving revision 1.1.2.4.2.5.2.19 diff -u -p -r1.1.2.4.2.5.2.19 globalredirect.module --- globalredirect.module 3 Mar 2010 16:56:21 -0000 1.1.2.4.2.5.2.19 +++ globalredirect.module 11 Mar 2010 21:27:40 -0000 @@ -184,6 +184,22 @@ function globalredirect_init() { } } + // Look for another alias, with lower pid, pointing to the same source + $sql = " + SELECT + a.dst + FROM + {url_alias} a + INNER JOIN + {url_alias} b + ON b.src = '%s' AND b.dst = '%s' + WHERE + a.src = '%s' AND a.pid < b.pid + "; + if ($proper_alias = db_result(db_query($sql, $request, $alias, $request))) { + drupal_goto($proper_alias, $query_string, NULL, 301); + } + // If no alias was returned, the final check is to direct non-clean to // clean - if clean is enabled if ((variable_get('globalredirect_nonclean2clean', GLOBALREDIRECT_NONCLEAN2CLEAN_ENABLED) == GLOBALREDIRECT_NONCLEAN2CLEAN_ENABLED) && ((bool)variable_get('clean_url', 0)) && strpos(request_uri(), '?q=')) {