diff -u b/redirect.admin.inc b/redirect.admin.inc --- b/redirect.admin.inc +++ b/redirect.admin.inc @@ -525,7 +525,6 @@ if (empty($form_state['values']['override'])) { if ($existing = redirect_load_by_source($redirect->source, $redirect->language)) { - $existing = $existing[1]; if ($redirect->rid != $existing->rid && $redirect->language == $existing->language) { // The "from" path should not conflict with another redirect $form_state['storage']['override_messages']['redirect-conflict'] = t('The base source path %source is already being redirected. Do you want to edit the existing redirect?', array('%source' => $redirect->source, '@edit-page' => url('admin/config/search/redirect/edit/'. $existing->rid))); diff -u b/redirect.module b/redirect.module --- b/redirect.module +++ b/redirect.module @@ -247,14 +247,14 @@ // Remove query string from request uri. $request_uri_parts = explode('?', request_uri()); - $request_path = $request_uri_parts[0]; + $request_path = urldecode($request_uri_parts[0]); // Redirect the front page to the root level. if ($is_front_page && variable_get('redirect_global_home', 1) && !variable_get('redirect_global_canonical_front', 0) && base_path() != $request_path - && "/$language->prefix" != $request_path) { + && base_path() . $language->prefix != $request_path) { return redirect_redirect((object)array('redirect' => '', 'type' => 'global')); } @@ -263,7 +263,9 @@ if ((!$is_front_page && variable_get('redirect_global_canonical', 1) || $is_front_page && variable_get('redirect_global_canonical_front', 0)) && $alias != $path - && $alias != $original_path) { + && $alias != $original_path + && base_path() . $alias != $request_path + && base_path() . $language->prefix . '/' . $alias != $request_path) { return redirect_redirect((object)array('redirect' => $alias, 'type' => 'global')); } @@ -337,7 +339,7 @@ // Fetch the current redirect. if ($redirect = redirect_get_current_redirect()) { - redirect_redirect((object) reset($redirect)); + redirect_redirect($redirect); } // Get the request URI without the $base_path prefix. @@ -386,7 +388,7 @@ redirect_redirect((object)array('redirect' => $request_uri . '/', 'type' => 'global')); } - // Force langauge prefix. + // Force language prefix. if (variable_get('redirect_global_language_prefix', 0) && module_exists('locale')) { require_once DRUPAL_ROOT . '/includes/language.inc'; list($language, $raw_path) = language_url_split_prefix($request_uri, language_list()); @@ -648,7 +650,7 @@ $context = array('language' => $language, 'query' => $query); drupal_alter('redirect_load_by_source', $redirects, $source, $context); - return !empty($redirects) ? $redirects : FALSE; + return !empty($redirects) ? reset($redirects) : FALSE; } }