It's possible that a Drupal site that was once configured to run with clean URLs later on stops doing so. After that, almost all content is inaccessible, because the paths being generated are not supported by the hosting platform.
This occasionally happens
- after transferring databases between hosts,
- taking a local copy,
- restoring from a backup (and leaving the .htaccess behind),
- deleting the .htaccess,
- or even from your host (or you) making inadvertent security changes.
The problem is that you cannot set it back, because you cannot browse to the specific configuration page anymore.
Drupal checks once if clean URLs are supported before allowing you to enable them, then assumes that things will continue working.
The simplest way to resolve this is by entering the 'unclean' system paths directly.
If you have locked yourself out, visit
http://example.com/user just like you do to re-enable offline sites.
You can log in there, enough to become admin, although none of the navigation will work yet.
http://example.com/admin/settings/clean-urls (in DRUPAL 5 and 6) or
http://example.com/admin/config/search/clean-urls (in DRUPAL 7) to view the page where you can unset clean URLs.
Your interface will be usable again.
Other options that should get the same result include:
- Run the drush commands:
drush vset clean_url 0 --yes
- Run the mysql commands:
UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url'; DELETE FROM cache;
- Alternatively, you can modify the appropriate settings.php file to include the line
$conf['clean_url'] = 0;
at the bottom (or similar code in the site settings array you'll see there).