Question

I've created a custom menu item in my Drupal 6 website by defining it in a custom module. This is an extremely simple MENU_NORMAL_ITEM menu item. The menu item is defined as

/**
 * Implementation of hook_menu().
 */
function menu_test_menu() {
  $items['menu_test'] = array(
    'title' => 'Menu Test',
    'page callback' => 'menu_test_hello',
 'access callback' => TRUE,
 'type' => MENU_NORMAL_ITEM,
  );

  return $items;
}

Since I have clean URLs on, the path should be www.example.com/menu_test. That URL gives me a 403 error. But, if I enter www.example.com/?q=menu_test, everything works fine. Why am I getting the 403 error? The menu item is useless because it's always trying to go to the clean URL path, which should work but doesn't for some reason.

Thanks for the help!

To be clear... Clean URLs are enabled and the menu registry has been rebuilt several times.

Was it helpful?

Solution

This issue is specific to that path used in the example callback page "menu_test". Changing this callback path (for example, to "test_menu") resolves the issue. This was in fact an issue with the rewrite rule in the .htaccess file. Part of the rule looks for "test" as the ending of the path. So, in my case, I won't be able to use any path that ends in "test". This is why I was getting the 403 errors.

If you experience the same type of issue, check your rewrite rule for a similar condition. In my case, I've decided to simply avoid ending any of my paths with "test", which shouldn't be too difficult.

Thanks for the comments anyways! I'm just glad it's figured out now.

CORRECTION: It's not the rewrite rule... is the FilesMatch rule that protects certain files and directories.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top