How to only define hook_menu path to certain URL Consider this simple implementation of hook_menu()

/**
 * Implements hook_menu().
 */
function helloworld_menu() {
  $items['hello'] = array(
    'title' =&gt; 'Hello world!',
    'page callback' =&gt; 'helloworld_page',
    'access callback' =&gt; TRUE,
  );

  return $items;
}

/**
 * Page callback for /hello.
 */
function helloworld_page() {
  return "Hello World!";
}


This code work when I visit example.com/hello, but so does when I append extra argument to the url like example.com/hello/world. How do I only define the example.com/hello only without getting all these 'derivative' URL defined as well?
Per the hook_menu() docs:


  When path 'abc/def' is requested, no further path components are in
  the request, and no additional arguments are passed to the callback
  function (so $ghi and $jkl would take the default values as defined in
  the function signature). When 'abc/def/123/foo' is requested, $ghi
  will be '123' and $jkl will be 'foo'. Note that this automatic passing
  of optional path arguments applies only to page and theme callback
  functions.


In other words, it's a feature of the Drupal menu routing system to accept additional path components. 

If you're looking to try to circumvent this, you can use an access callback function to enforce your sole path:

/**
 * implements hook_menu().
 */
function helloworld_menu() {
  $items['hello'] = array(
    'title' =&gt; 'Hello world!',
    'page callback' =&gt; 'helloworld_page',
    'access callback' =&gt; 'helloworld_callback',
  );

  return $items;
}

/**
 * Page callback for /hello.
 */
function helloworld_page() {
  return "Hello World!";
}

/**
 * Access callback for /hello. 403 on addition path components.
 */
function helloworld_callback() {
  return (request_path() == 'hello');
}