--- includes/menu.inc 2010-12-23 14:04:30.000000000 +0100 +++ includes/menu.inc 2010-12-23 14:11:22.000000000 +0100 @@ -492,6 +492,19 @@ function menu_execute_active_handler($pa menu_rebuild(); } if ($router_item = menu_get_item($path)) { + // If we are on a valid page and the server has responded with a 404 + // it means that the request is being handled by the 404 handler and + // the site will not work correctly. + // Turn clean URLs off, if they are on, and then redirect the user to + // the page they were expecting. + if (isset($_SERVER['REDIRECT_STATUS']) && $_SERVER['REDIRECT_STATUS'] == 404) { + if (variable_get('clean_url', '0')) { + watchdog('system', 'System no longer supports clean URLs, turning off automatically.', array(), WATCHDOG_WARNING); + variable_set('clean_url', 0); + } + drupal_goto($read_only_path, array(), 307); + } + if ($router_item['access']) { if ($router_item['include_file']) { require_once DRUPAL_ROOT . '/' . $router_item['include_file'];