Solved

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

Posted on 2011-03-03
3
481 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 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

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

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

828 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