Solved

Drupal hook menu : some links give 403 error unless in Uppercase

Posted on 2011-03-03
3
494 Views
Last Modified: 2012-05-11
Hi

I've many Drupal sites but have hit a brick wall with a very strange issue.

I have hook_menu setup in my module with code as follows :

 $items['home'] = array(
    'title' => 'HOME',
    'page callback' => 'home',
    'menu_name' => 'primary-links',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'includes/_mysite_home.inc'
  );

$items['about'] = array(
    'title' => 'ABOUT',
    'page callback' => 'about',
    'menu_name' => 'primary-links',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'includes/_mysite_about.inc'
  );

The 'home' link works fine .. but the 'about' link gives a 403 Error .. and I can see the page if I change 'about' to 'ABOUT' at the end of the address in the address bar and refresh the page.

Wasted a lot of time trying to make this go away .. hopefully someone can point me in the right direction.

Cheers

E.
0
Comment
Question by:eppyfone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Expert Comment

by:oliverpolden
ID: 35032448
What's wrong with just creating a page via the CMS with those addresses?

Anyway, do you have an 'about()' function in _mysite_about.inc?  If you have a home() function and not an about() function, that's probably the difference.

'page callback' => 'about' means that Drupal will try to use a function called about.  Without it I guess the menu system will not properly register the item and you get an access denied because the access arguments
0
 

Accepted Solution

by:
eppyfone earned 0 total points
ID: 35035153
Hi .. Thanks for your response .. but I've solved this myself !!

There was a folder in the root of the file system called 'about'.
Drupal was confused and decided to not allow access to it as it was not part of the CMS setup.
It therefore made a decision to put the internal page in a path with Caps to differentiate.
Smart or obstinate .. still gotta love it.

So .. check there's not a stray folder in the root setup.

Job done ... moving on...

E.
0
 

Author Closing Comment

by:eppyfone
ID: 35865618
Solved myself as explained above
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question