Index: globalredirect.module =================================================================== --- globalredirect.module (revision 1712) +++ globalredirect.module (working copy) @@ -17,30 +17,32 @@ */ function globalredirect_init() { if(isset($_REQUEST['q']) && function_exists('drupal_get_path_alias') && !isset($_REQUEST['destination']))\ { - + // drupal_get_normal_path will allow custom_url_rewrite to affect $q. + $q = drupal_get_normal_path($_REQUEST['q']); + // Get the Query String (minus the 'q'). If none set, set to NULL $query_string = drupal_query_string_encode($_GET, array('q')); if (empty($query_string)) { $query_string = NULL; } - + // If current path is also the frontpage, redirect to http://www.example.com. - if (!empty($_REQUEST['q']) && drupal_is_front_page()) { + if (!empty($q) && drupal_is_front_page()) { drupal_goto('', $query_string, NULL, 301); } // Trim any trailing slash off the end (eg, 'node/1/' to 'node/1') - $request = trim($_REQUEST['q'], '/'); + $request = trim($q, '/'); // Check the path (eg, node/123) for an alias. If one is found, redirect. if ($alias = drupal_get_path_alias($request)) { // If alias is different to the request, redirect... - if ($alias != $request) { + if ($alias != $_REQUEST['q']) { drupal_goto($alias, $query_string, NULL, 301); } - + // If the request produced by the trim above differs to the request then redirect (basically, de-slas\ h) - if ($request != $_REQUEST['q']) { + if ($request != $q) { drupal_goto($request, $query_string, NULL, 301); } }