4

Today i have transferred my d7 site to a new ubuntu vps, then in the Apache config files i made this change: AllowOverride None to AllowOverride All and now d7 site is working under clean url.

While transferring the website i have disabled the clean url option from the admin/config/search/clean-urls, but here is the difficulty. Now clean url works but in order to enable clean url when i click on the "Run the clean URL test" button then it shows "The clean URL test failed." though it is working :/

I have cleared all the cache data with no luck.

Now what are alternative ways to enable clean url manually in d7?

6

Clean URL state is managed through the Drupal variable clean_url.

  • clean url disabled: clean_url is 0

  • clean url enabled: clean_url is 1

You can force this value by:

  • Using drush

    drush vset clean_url 1
    
  • Using a direct SQL query

    UPDATE variable SET value=1 WHERE name='clean_url';
    
  • Force a value in settings.php

    $conf['clean_url'] = 1;
    
  • 1
    Variables are cached, so the UPDATE won't take right away. Assuming a SQL backend, you would need to DELETE FROM cache_bootstrap WHERE cid = 'variables' – mpdonadio Jul 9 '14 at 14:19
  • Thanks for your answer, is that the table name should be dr_variable ? – rakibtg Jul 9 '14 at 14:27
  • 1
    The talbe name is 'variable', but if your using a database prefix it should be '<your_prefix>_variable'... if you can just use drush, is the best way. – sanzante Jul 9 '14 at 14:31
1

Here is a non Drush solution:

The trick,if the clean url test fails on drupal 7 (but you think it should be working) is to edit the url.

Your current url at the clean url page should be; http://www.your-site.com/?q=admin/config/search/clean-urls

So edit it and change it to; http://www.your-site.com/admin/config/search/clean-urls

You should now be able to see the box to enable clean URLs. Enable the clean urls and visit some of the sites inner pages to check that it is working. If you have any problems you can turn them off again here: http://www.your-site.com/?q=admin/config/search/clean-urls

0

Setting

$GLOBALS['conf']['clean_url'] = 1;

line 587 in settings.php always work for me.

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.