If you're experiencing the "Page Not Found" error on every single page of your Drupal 6 site, it is possible that your menu router data got corrupted or deleted. This is most likely to happen when there is an error that occurs during the process of enabling a module. See this bug report: http://drupal.org/node/238760 The problem should be less likely to occur after the Drupal 6.3 update is out.

To fix this, your first step should be to try to figure out what might have caused it and to undo those last few modifications that you made to the site. Typically, this would involve reverting to old versions of modules, or even disabling all non-core modules. Since the site is not accessible, you may need to disable the modules by SQL. Set the status field of the suspect contributed module(s) to 0 in the {system} table. There are plenty of threads in the forum that discuss how to do this, if you are not familiar.

Once you've done that, you just need to rebuild your menu system to give you access again. The easiest way to do this is to run update.php. Even if there are no updates, running through the process will also rebuild the menu router.

If for some reason running update.php doesn't work, you may need to temporarily alter some code as outlined below. This should be a last resort, and is not normally needed.

To rebuild your menu, find the menu_execute_active_handler() function inside /includes/menu.inc (approx at line 334) and force it to call menu_rebuild().

I.e. temporarily change this:

 if (variable_get('menu_rebuild_needed', FALSE)) {
    menu_rebuild();
  }

to this:

 //if (variable_get('menu_rebuild_needed', FALSE)) {
    menu_rebuild();
  //}

Now if you try to access your site again, it will rebuild the menus and you should be back to normal.

IMPORTANT: Don't forget to undo your changes to menu.inc, otherwise your site will suffer a huge performance hit!

Comments

dungkal’s picture

Running the update.php script resolved my "page not found" problem.

sastha’s picture

I was not able to see the Tagadelic settings page and any of its menu in admin. If I try to directly access it using admin/settings/tagadelic, it was showing "Page not found" error. By running update.php, the problem is resolved.

Thanks for the useful information

zazinteractive’s picture

Update.php worked for me as well

VJV’s picture

Thaks for this. I was enabling Ubercart modules and when it was creating tables to the MySQL something went wrong.
Update.php gave: Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)

Rebuilding menus did the trick and everything is fine now.

Thanks a lot

Joel MMCC’s picture

I figured out what was causing the problem for us. Basically, one of the client staff with editing permissions had edited a Menu Item path to an invalid path, and it apparently nuked the whole menu router system. I had to go into the database and find and delete the corrupted record manually, since we were locked out of everything, and not even using a PHP script to clear the caches and perform update.php could fix it! Once I deleted the corrupted record, then those things worked and the site is back up.

This is a serious vulnerability, potentially a security issue. I’ll submit it accordingly.

Arla’s picture

Editing menu.inc worked for me on Drupal 7.2, too. Lines are approximately around line 496.

webdesign2’s picture

I was really stuck until I found this post. Did not know what happened. Applied a drupal database update and the whole website went down. Could not access any login panel.

I did as suggested above and my website was up and going again.

Thanks ever so much

Hostgator support officially in my bad books

danielsmiti’s picture

Hello i already did all the stepts but still nothing, I don't know whats wrong. My issue it's in here http://drupal.org/node/1569432 can somebody help me?

Orbb’s picture

Hey,

I was wondering, is friendly URLs enabled in your Drupal site? If so make sure you have Uncommented mod_rewrite option in "wamp\bin\apache\Apache2.2.21\conf\httpd.conf" file.

This usually happens when we reinstall the wamp server and load existing copy of Drupal into it.

Kristen Pol’s picture

If you are on Ubuntu, here is a tutorial to enable clean URLs (mod_rewrite) for Apache:

http://www.seangw.com/wordpress/2012/01/how-to-enable-mod_rewrite-in-apa...

-Kristen
Profile: https://www.linkedin.com/in/kristenpol
Drupal 7 Multilingual Sites: http://kristen.org/book

sauravforblog’s picture

Hello Sir,

I have installed a module Similar and there was some problem with the module installation on my drupal 6 website www.gamezinfo.com. Because of which I got some SQL error on my site. Now I can only access the home page of my website and all the other options are not working from the admin panel. My webhost (www.arvixe.com) has tried to restore complete back ups of files and databases but still the problem persists. I have tried the above steps and still it doesnt work.

Sir, I am really helpless. Please help me in recovering my website. I am really scared to loose my website.

Thanks and Regards,
Saurav

icstars’s picture

after running the update.php, we received Fatal error: Call to undefined function node_get_types() in /sites/all/modules/cck/content.module on line 1471

it turned out that the node module in the system table had been set to zero / off. not sure if this was a byproduct of the original corrupt menu router or a result of something in update.php.

if anyone encounters the node_get_types problem after the page not found problem, run this sql to see:

SELECT STATUS FROM system WHERE NAME = 'node'

icstars’s picture

our site goes down about every two months now with the node module somehow getting turned off. would love to know the root cause here. we have a workaround now that runs a cron job every few minutes to make sure node module stays on, but that's not an actual solution.

longtom’s picture

I had this issue on a d6 site I inherited...
However, on inspecting the db, it was being written to.

The above did not work for me.

What worked was my home alias was built oddly (for other reasons, it is set in a module). So the alias does
not rebuild itself correctly, and when it is removed, the pages are lost.

Lesson if the above is not working is to inspect the page_front variable in the variable table, and the url_alias table.

afagioli’s picture

Worked fine to my d6 site. thanks!

kristat’s picture

Check your .htaccess file. If this is not in place you will get page not found on all pages

SeifBh’s picture

Thankyou

bfmontenegro’s picture

I backed up my Drupal 7 site and moved it to another server. I had this same problem withe the menu and not found page. I found out that my new site didnt have the correct .htaccess file. For some unknown reason it just wasnt there so I want to my backup and copied it on the root of my website and it worked. No more page not found errors.

davidjmcq’s picture

I had to move to a different server and for unknown reasons the .htaccess file in the drupal root directory failed to transfer. It was as simple as copying it from a back up.
Please don't make any comments about still running Drupal 6! I'm sure I'm not the only one stuck with it.