Override an url with hook_menu_alter : problem with the file path In 'mymodule', i try to override a menu url with hook_menu_alter, like this :

global $base_url;

$items['node/%node/delete'] = array(
  'page arguments' =&gt; array('myfunction', 1),
  'file' =&gt; $base_url .'/'. drupal_get_path('module', 'mymodule') .'/includes/custom_node_delete_confirm.inc',
);  


I have an error because the file path is relative and begins with a "/"

Failed opening required
'/http://localhost/mysite/sites/all/modules/mymodule/includes/custom_node_delete_confirm.inc'


and this doesn't work too:

'file' =&gt; 'includes/custom_node_delete_confirm.inc'


How can i do this ? Thank You
You can set the file path explicitly:


  file path: The path to the directory containing the file specified in "file". This defaults to the path to the module implementing the hook.


So your code might look like:

$items['node/%node/delete']['page arguments'] = array('myfunction', 1);
$items['node/%node/delete']['file'] = 'includes/custom_node_delete_confirm.inc';
$items['node/%node/delete']['file path'] = drupal_get_path('module', 'mymodule');


Be careful not to completely overwrite an existing router item unless you absolutely need to, in your example you're removing the required access callback/access arguments, and also the title; instead only change the values you need to as in the example above.