Last updated 4 November 2016. Created on 2 February 2004.
Edited by rajveergang, mr.ashishjain, kristoferaberg, LeeHunter. Log in to edit this page.

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 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.

Next, enter (in DRUPAL 5 and 6) or (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).

Looking for support? Visit the forums, or join #drupal-support in IRC.


EvivE’s picture

I have it broke my site when i tried clean urls.

jhr’s picture

Use firebug to change the URL in the form tag.

Change it to:

<form ... action=?q=node&destination=node>

Then browse to..

brett1’s picture

I used the drush line worked for me, been struggling with this for a while.

I think the path module may be enabled by default in D7 which caused the issue??

I tried to disable (path) on the localhost, clear cache and backup and migrate the
database to the remotehost. - Although it did not work I think if I ran update.php (and cron?)
before the backup and migrate this approach may have worked.

Anyway - the drush cmd worked for me
THANX’s picture

This is a bug and it should be fixed.
If you can set a value then it must be possible to unset it.
The assumption that unsetting is not required is very wrong.

dman’s picture

It's no assumption - it's just that if you put the system into an unstable state, it can be tricky to recover.
The option can be set/unset through the UI at ?q=admin/settings/clean-urls as described above.’s picture

We have been stumped on a blocked loggin for about 3 hours. We switched dev environments and upon setting up our new apache2 server none of the sites would allow user/1 to login. Then we found your post and used:

drush vset clean_url 0 --yes

We were getting major Ajax page 404 errors trying to login.

Thanks so much to the drupal community, it means more then you know:)

More on this...
The symptoms are created for us when we did not have mod_rewrite enabled on our dev server. This disables clean urls on your site in turn creating 404 ajax errors on login if you have ajax_login. If you dont have ajax_login and you try to login nothing will happen the page will just reload and not login.

Here are 4 key installs on a fresh Ubuntu 12.04 lts install.
user_name@computer:~$sudo apt-get install lamp-server^
user_name@computer:~$sudo apt-get install phpmyadmin
user_name@computer:~$sudo apt-get install php5-curl
user_name@computer:~$sudo a2enmod rewrite
These commands will install and configure most of if not all of what you will need to get drupal up.

Here are some others you will need.
user_name@computer:~$sudo server apache2 restart (or reload) sudo /etc/init.d/apache2 reload
user_name@computer:~$sudo a2ensite
user_name@computer:~$sudo nano /etc/mysql/my.cnf
user_name@computer:~$sudo nano /var/www/yourfilename.fileextention

darshana12’s picture

Thank you so much i wasted my 2 days to solve this issue.
mysql command worked for me. Now my local site is up.