1 redirect.api.php hook_redirect_alter($redirect)

Act on a redirect being redirected.

This hook is invoked from redirect_redirect() before the redirect callback is invoked.

Parameters

$redirect: The redirect that is being used for the redirect.

See also

redirect_redirect()

backdrop_page_is_cacheable()

Related topics

File

core/modules/redirect/redirect.api.php, line 277
Hooks provided by the Redirect module.

Code

function hook_redirect_alter($redirect) {
  // Make any redirect going to the homepage considered temporary.
  if ($redirect->redirect = '<front>') {
    $redirect->type = 302;
  }
}