Solved

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

Posted on 2011-03-03
3
476 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
  • 2
3 Comments
 
LVL 9

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to count occurrences of each item in an array.

861 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now