hook_menu giving 404 I am trying to create module in Drupal 6.22:

function example_video_perm(){
    return array("video access");
}

function example_video_menu() {
    $items = array();
    $items['video/%nid'] = array(
        'title' =&gt; '',
        'page callback' =&gt; 'video_load',
        'access arguments' =&gt; array('video access'),
        'type' =&gt; MENU_CALLBACK,
    );
    return $items;
}

function video_load($nid) {
    print_r($nid); 
}


But whenever i am typing in http://example.com/video/nid, its getting redirected to 404. Please help.
The problem is that the path associated to your menu item is using a wildcard ("%nid"), but your code is not defining an auto-loader for that wildcard.


For a wildcard such as "%nid" Drupal is looking for a function called nid_load(), which doesn't exist; if you want to use video_load(), then the placeholder should be "%video" and not the one you are using. If that part of the path is a node ID, then you should use "%node" that would cause Drupal to use node_load(), which is a function defined from the Node object and that returns a node object for the node ID passed as argument.
The auto-loader function should return an object or an array. If the auto-loader function is not returning a value, then Drupal would act as if the returned value is FALSE, which is the value that causes Drupal to return to the user the "page not found" error, as it understands the value as meaning "I didn't found what the user is looking for." Return an object (which is what node_load() does), or an array, and the user will not see the "page not found" error anymore.


In your case, the URL for the menu item defined from the module is something similar to http://example.com/video/1, or http://example.com/video/2, where 1 and 2 are (I presume from your code, as you use "%nid" as wildcard, which should mean "node ID") the node IDs of existing nodes.
Take as example the URL for the menu item associated with the node view page, which is "node/%node"; you invoke that page with, e.g., http://example.com/node/1, and Drupal shows you the content of the node with node ID equal to 1.

If you don't want to use an auto-loader, then your menu item should use a path such as "video/%" and Drupal would not look for an auto-loader function. What I reported about the URL to use to invoke the page served from your module is still valid, except that the URL could be  http://example.com/video/asdfsdfwer, http://example.com/video/2, http://example.com/video/azder54gfg because the % in "video/%" matches any string.

Bart is correct in saying that using "%nid" as placeholder in the path, when the page callback, the access callback, or the title callback doesn't get any argument derived from that placeholder, doesn't make sense. 

For more information, you can look at the documentation for hook_menu(); Wildcard Loader Arguments, Wildcard usage and core's wildcards, Dynamic argument replacement (wildcard), Wildcard, ancestors and fitness; and, as general information on how Drupal menu system work, Drupal menu system (Drupal 6.x).