Empty search redirect to Home page I am using Drupal 7 and my search functionality is not working properly.

When I click on search button without enter any keyword it redirects to home page with showing the message Please enter some keywords. and same thing happens when there is no result found for the respective search keyword.

So can anyone please guide me how can I redirect the empty search to search page?

Thanks in advance...
Something like this should work:

/**
 * Implements template_preprocess_search_results.
 */
function YOUR_THEME_preprocess_search_results(&amp;$variables){
  $results = $variables['results'];
  if(count($results) == 0){
    drupal_goto('&lt;front&gt;');
  }
}