开发者

Why do i get a 403 error when viewing a Drupal custom menu item via clean url?

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_me开发者_开发百科nu().
 */
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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜