It seems I have a similar problem to the one described in this thread.

You enter a search query and get redirected to the correct URL but the page displays the system message template saying Your search did not return any results instead of redirecting to the no-results template.

Removing the exp:search:search_results tag causes the page to render correctly, but obviously without any search results in it. {exp:search:total_results}{total_results}{/exp:search:total_results} also shows up as 0.

So why doesn't EE redirect to the no-results template if there are no results? Although it doesn't seem to matter what I enter, I get the error message each time.

Template code


<input type="text" name="keywords">
<input type="submit" value="Go">


<p>There were <strong>{exp:search:total_results}{total_results}{/exp:search:total_results}</strong> results for a search for <em>{exp:search:keywords}</em>.</p>

<ul class="search-results">
        <a href="{auto_path}/">{title}</a>

1 Answer 1


It's a bug in EE's native Search module. Bug reported here: https://support.ellislab.com/bugs/detail/19828

Here's the fix:

Starting in line 1290 of system/expressionengine/modules/search/mod.search.php


if ($query->num_rows() == 0 OR $query->row('total_results')  == 0)
  return ee()->output->show_user_error('off', array(lang('search_no_result')), lang('search_result_heading'));


if ($query->num_rows() == 0 OR $query->row('total_results')  == 0)
  if ($query->row('no_result_page') == "")
    return ee()->output->show_user_error('off', array(lang('search_no_result')), lang('search_result_heading'));
    $path = reduce_double_slashes(ee()->functions->create_url(trim_slashes($this->_meta['no_result_page'])).'/'.$hash.'/');
    return ee()->functions->redirect($path);
  • Given that you posted exactly the same answer on the other thread, can we close this one as a duplicate? Oct 21, 2013 at 6:38
  • Yeah, of course. But the other one needs at least an up vote first. Oct 21, 2013 at 10:28
  • Done. @Tyssen let me know if Stephen's answer doesn't solve your problem and we can reopen this question. Oct 21, 2013 at 17:38
  • 1
    Not quite. That fixes the system template error issue, but I'm still ending up at the results template with it saying that there are 0 results instead of the no-results template. Should I be following this up with EllisLab instead?
    – Tyssen
    Oct 21, 2013 at 23:55
  • Definitely chime in on the bug report linked above. Oct 22, 2013 at 0:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.