Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

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

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
eppyfone
Asked:
eppyfone
  • 2
1 Solution
 
oliverpoldenCommented:
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
 
eppyfoneAuthor Commented:
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
 
eppyfoneAuthor Commented:
Solved myself as explained above
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now