Changing URL alias for search module action I'm struggling to make the Search module recognize the presence of a URL alias that I created for 'search/node'. It however stubbornly uses the default path.

In my template I use something like:

function mytheme_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  switch($form_id){    
  case 'search_form':
    $form['#action'] = drupal_get_path_alias('/search/node'); // = '/' . drupal_get_path_alias('search/node') does not work either
    break;

  }
}


When the results are displayed, the URL still reads:

/search/node/[search-string]


Does anyone know whether the path is hard-coded and omits the alias function?
I've had a lot of misery trying to customise the URLs for the search module so I feel your pain!

It's a submit handler that redirects to the search/node page so you'll need to add your own handler to override the redirect:

function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'search_form') {
    $form['#action'] = 'search';
    $form['#submit'][] = 'MYMODULE_search_form_submit';
  }
  else if ($form_id == 'search_box_form' || $form_id == 'search_theme_form') {
    $form['#submit'][] = 'MYMODULE_search_form_submit';
  }
}

function MYMODULE_search_form_submit(&amp;$form, &amp;$form_state) {
  $default = search_get_default_module_info();
  $form_state['redirect'] = str_replace("$default[module]/", '', $form_state['redirect']);
}


That code comes from a module who's sole purpose is to allow users to search at search/string rather than search/node/string so you'll probably need to change a couple of things to match your alias settings, but it might help start you off.

Here's a bit of extra code that's used to override the search URL using a hook_menu_alter():

function MYMODULE_menu_alter(&amp;$items) {
  drupal_static_reset('search_get_info');
  $default_info = search_get_default_module_info();
  if ($default_info) {
    foreach (search_get_info() as $module =&gt; $search_info) {
      $path = 'search/' . $search_info['path'];
      unset($items[$path]);
      unset($items["$path/%menu_tail"]);
    }

    $items['search/%menu_tail'] = array(
      'title' =&gt; 'Search',
      'load arguments' =&gt; array('%map', '%index'),
      'page callback' =&gt; 'search_view',
      'page arguments' =&gt; array($default_info['module'], 1),
      'access callback' =&gt; '_search_menu_access',
      'access arguments' =&gt; array($default_info['module']),
      'type' =&gt; MENU_CALLBACK,
      'file' =&gt; drupal_get_path('module', 'search') . '/search.pages.inc'
    );
  }
}


It basically removes the menu items for the search path and replaces them with a single one. It's only useful in very specific conditions (i.e. when you've only got one search type enabled) but it's something to go off at least.