5

Another developer has sent me a completed Drupal 7 website. When I installed it, the home page uses clean URLs, which don't work; example.com/index.php?q=/node/123 does work.

When I go to example.com/index.php?q=admin/config/search/clean-urls, there is not a check box to turn clean URLs on. Is there a way to disable the clean URLs, and start the process again?

  • Is your site configured in some sub directory relative to domain root? If so then change Rewritebase as 'RewriteBase /subdirectory/' in .htaccess – Shoaib Nawaz Aug 12 '11 at 21:46
10

When clean URL are enabled, the page at admin/config/search/clean-urls is like the following one:

screenshot

When clean URLs are not enabled, you should see a description such as the following one, and a button to test the clean URLs ("Run the clean URL test"):

Use URLs like example.com/user instead of example.com/?q=user. If you are directed to a Page not found (404) error after testing for clean URLs, see the online handbook.

Once you click on the submission button ("Run the clean URL test"), Drupal would check if the clean URL are possible to enable, and show you the checkbox to enable them, which should be not selected. If that doesn't happen, the online handbook reported in the description has a link to How do I unset the clean URLs? where three methods are listed:

  • Run the following Drush commands:
    drush vset clean_url 0 --yes
  • Run the following MySQL commands:
    UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url';
    TRUNCATE cache;
  • If previous update statement didn't solve it, some drupal version may need a different key :
    UPDATE variable SET value = 'i:0;' WHERE name = 'clean_url';
    TRUNCATE cache;
  • Alternatively, you can modify the appropriate settings.php file to include the following line at the bottom (or similar code in the site settings array you'll see there).

    $conf['clean_url'] = 0;
    
  • thanks these worked, however i know have the following issue. /questions/9237/nice-urls-enabled-but-urls-contains-ids-not-titles – frosty Aug 14 '11 at 8:03
3

seems exist some ways to disable and start again:

one way in settings.php

$conf = array(
    'clean_url' => 0,
);

other way (database):

Browse on "variable" table in Drupal database, and change the value of "clean_url" from s:1:"1"; to s:1:"0";

you can confirm this here http://drupal.org/node/5590

  • regarding the database way, please note that you must clean cache after made the changes in the variable table (according drupal.org/node/5590) – cigotete Aug 12 '11 at 23:25
0

A common cause for clean URLs not working on a site you received from another developer is that the .htaccess file that comes with Drupal got lost in transmission somewhere (e.g. when someone copied the site by dragging and dropping files; .htaccess would be a hidden file, or when someone does a "cp -R *" - again, .files left out). It is required to have the web server translate the clean URLs the site generates because of the setting in something that the Drupal router can actually understand.

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.