Hi,
Is there a possible in Search 404 to redirect the visitor, when no result is found ?

You have integrated the option to redirect the user to the first search result, but when no result is found, i want to redirect to frontpage.

best regards
Tom

Comments

jr-ewing’s picture

The solution based on search404-6.x-1.x-dev.tar.gz from 2010-Jul-18:

search404.module

-------------------------------
Replace Line 125:

$keys = search404_get_keys();

with:

      if (variable_get('search404_custom_page', '') == '') {
        // If no custom page has be set, display the default search form
        $keys = search404_get_keys();
      } else {
        // Redirect to the custom page
        search404_goto( variable_get('search404_custom_page',''));
      }

-----------------------------

ADD Line 224

  $form['search404_custom_page'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom page if no nodes has been found'),
    '#description' => t('This page will be displayed if no nodes will be found. Leave blank to disable this option.'),
    '#default_value' => variable_get('search404_custom_page', ''),
  );

Thats all - and working fine for me

best regards
Tom

zyxware’s picture

Title: Redirect to custum page » Redirect to custum page when no results are found
Version: 6.x-1.9 » 6.x-1.x-dev

There is a problem with this. The redirection will return a status code of 301 and 302 instead of a 404 and this would defeat the purpose.

zyxware’s picture

Status: Active » Closed (won't fix)
Issue tags: -redirect, -frontpage