subi
subi

Reputation: 89

Drupal 6- 404 is not showing for menu item URL pattern implemented using hook_menu

I have a hook menu

$items['mypage'] = array(
    'title' => t('My Page title'),
    'description' => '',
    'type' => MENU_CALLBACK,
    'page callback'=> 'my_home_page',
    'access arguments' => array('access content'),
);

Now when I access a page which is not existing like "mypage/blahblah" it will show my home page(ie http://www.mydomain.com/mypage/blahblah is rendering content of http://www.mydomain.com/mypage). Instead of this I need to show a 404 page.

Can anybody give comment on this ?

Upvotes: 1

Views: 234

Answers (1)

Rahul PK
Rahul PK

Reputation: 270

You can try to paste the following code in your page call back function "my_home_page"

if ('' != arg(1)){
    drupal_not_found();
}

Thanks Rahul

Upvotes: 0

Related Questions