1 redirect.module redirect_url_inbound_alter(&$path, $original_path, $path_language)

Implements hook_url_inbound_alter().

File

core/modules/redirect/redirect.module, line 238

Code

function redirect_url_inbound_alter(&$path, $original_path, $path_language) {
  // If the inbound path has been changed, then attempt to find a redirect
  // matching the original path and save it for processing later in
  // redirect_init(). For example, if the Sub-Pathauto module changes the path
  // 'foo/redirect' to 'node/1/redirect', and there is a redirect enabled for
  // the path 'foo/redirect', then redirect_init() would normally fail since it
  // would not find a match.
  if ($path !== $original_path && $original_path === $_GET['q']) {
    $current_langcode = !empty($path_language) ? $path_language : $GLOBALS['language']->langcode;
    $current_query = backdrop_get_query_parameters();
    if ($redirect = redirect_load_by_source($original_path, $current_langcode, $current_query)) {
      redirect_set_current_redirect($redirect);
    }
  }
}