You are here

function ape_redirect_alter in Advanced Page Expiration 7

Implements hook_redirect_alter().

This integrates the redirect module which uses its own method of redirecting rather than drupal_goto and will implement the standard page cache length.

File

./ape.module, line 87
Allows finer control of the Cache Control header.

Code

function ape_redirect_alter(&$redirect) {
  $max_age = NULL;
  if (variable_get('redirect_page_cache', 0)) {
    if ($redirect->status_code == '301') {
      $max_age = variable_get('ape_301_lifetime', 0);
    }
    elseif ($redirect->status_code == '302') {
      $max_age = variable_get('ape_302_lifetime', 0);
    }
    ape_cache_set($max_age);
    ape_set_cache_header($max_age);
  }
}