CLEAN URLs issue in Drupal

Many times we face a problem, where Drupal gives a trouble in enabling the Clean Url Feature.
Hereby, I am providing two solutions which you can try and see if it works.

Solution #1

  1. Make sure the rewrite module is enabled by going to /etc/apache2/mods-enabled.
      If "rewrite.load" is not there you will have to add it:
        $ sudo a2enmod rewrite
  2. Disable Site default..
        command: sudo a2dissite default
  3. Edit default file as 'root' in etc and set 'All' to 'AllowOverride' for DocumentRoot /var/www
        command: sudo gedit /etc/apache2/sites-available/default
  4. Enable site default..
        command: sudo a2ensite default
  5. Restart apache
        command: sudo service apache2 restart

Even after these steps, if you are facing some trouble in setting clean urls for fresh setup of drupal..try..
Solution #2:

  1. Add this code to /etc/apache2/httpd.conf:
        # fix for clean urls

        AllowOverride all
        RewriteEngine on
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    Then save the file.

  2. Restart Apache
        $ sudo /etc/init.d/apache2 restart
        OR sudo service apache2 restart

Finally, rerun your Clean URL test. You should now see a checkbox for enabling URLs. (You may have to clear your Drupal cache and Browser cache before running the test).

Feel free to post a comment if the solutios provided above still not working, would be happy to look into it further ahead and post solutions if possible.

Add new comment