hook_menu not working with alias I have a hook_menu:

$items['node/%/tokens/%api_token'] = array(
    'title' =&gt; 'View an API Call',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('api_token_edit', 1, 3),
    'access arguments' =&gt; array('edit own profile'),
    'type' =&gt; 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?
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.