I've a custom module named workingmodule. I get a 404 when visiting domain.com/workingmodule.

My module is enabled, and I cleared the cache. This id the code I am using in workingmodule.module.

* Implements hook_menu().
function workingmodule_menu() {
  $items = array();
  $items['workingmodule'] = array(
    'page callback' => 'workingmodule_blank_page_callback',
    'page arguments' => array(),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  return $items;

* Display the tagboard/custom content for page.
function workingmodule_blank_page_callback() {

Why does domain.com/workingmodule return a 404 error?

  • Maybe its something with my local environment? I've restarted Apache, and didn't get anything out of that... – dougblitz210 Sep 18 '15 at 20:35
  • Please update your post with the error you founded each time you attempted to flush the cache. – gerzenstl Sep 18 '15 at 20:59

I tested the code by adding that path and it works.

I suggest the following steps debug:

  1. Make sure that Drupal is able to flush the cache without any problem by checking if there is any errors at admin/reports/dblog
  2. If you didn't find any errors when you flushed the cache, try to add a die('checking hook_menu') on your hook_menu implementation to see if the hook is being executed.
  3. If you are not going to pass any arguments to that callback I suggest you to remove the line 'page arguments' => array(),
  4. Check your Apache/NGINX settings, it could contain something that is affecting that path.
| improve this answer | |
  • Thanks, apparently I was getting an error when clearing the cache! As dumb as I feel, I feel way better having this solved! – dougblitz210 Sep 18 '15 at 20:52
  • No worries, sometimes happens. If have a doubt, always check the logs. ;) – gerzenstl Sep 18 '15 at 20:53
  • Flush cash is always the answer, even when you've already done it. Sums up Drupal right there. – digitgopher Sep 19 '15 at 4:29

Remove the 'page arguments' => array(),

You're passing an array to a function that does not accept any arguments. Otherwise make your callback function function workingmodule_blank_page_callback($arg)

| improve this answer | |

Had the same problem but got an 500. Had to uncomment the RewriteBase in Drupal's .htaccess:

  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  RewriteBase /
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.