I have a hook_menu:

$items['node/%/tokens/%api_token'] = array(
    'title' => 'View an API Call',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('api_token_edit', 1, 3),
    'access arguments' => array('edit own profile'),
    'type' => MENU_LOCAL_TASK,

When visiting url: node/1229/tokens/1, it works as expected.

When visiting the friendly alias: mypage/tokens/1, it gives me a 404.

Why is this? I thought hook_menu used the internal arguments?

1 Answer 1


That behavior is not inclued in core. You can try this two modules:

  • Sub-pathauto (Sub-path URL Aliases): The Drupal Path module matches only full URLs when creating SEO-friendly aliases. This module extends that behavior by also matching known sub-paths and replacing them with their respective alias.

  • Extended Path Aliases: SImilar to previous module, but includes more functionlaity. The drawback is that it needs core patching (adding a line to nclude/path.inc) or installing PECL runkit library.

  • Awesome! I actually have Sub-pathauto enabled already (but only 1 deep). It didn't occur to me that could be an issue. I made it 2 deep and eureka! :) Thank you for this, it's been bugging me for hours.
    – Paul
    Feb 14, 2015 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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