You are here

function search404_goto in Search 404 7

Same name and namespace in other branches
  1. 6 search404.module \search404_goto()

Search404 drupal_goto helper function.

2 calls to search404_goto()
search404_page in ./search404.page.inc
Main search function.
search404_results in ./search404.page.inc
Get the results for a search.

File

./search404.page.inc, line 369
The search404 module search page related functions.

Code

function search404_goto($path = '') {

  // Overwrite $_GET['destination'] because it is set by drupal_not_found().
  $_GET['destination'] = $path;
  if (variable_get('search404_no_redirect', FALSE)) {
    $options = drupal_parse_url($path);
    $_GET += $options['query'];
    menu_set_active_item($options['path']);
    menu_execute_active_handler();
    exit;
  }

  // Set 301 redirect if so specified in settings else do default 302 redirect.
  if (variable_get('search404_redirect_301', FALSE)) {
    $http_status = 301;
  }
  else {
    $http_status = 302;
    if (variable_get('search404_do_custom_search')) {
      $meta_search404_noindex = array(
        '#tag' => 'meta',
        '#attributes' => array(
          'name' => 'robots',
          'content' => 'noindex',
        ),
      );
      drupal_add_html_head($meta_search404_noindex, 'meta_search404_noindex');
    }
  }
  drupal_goto($path, array(), $http_status);
}