Drupal – Enable clean URLs

Clean URLs makes the HTTP links easier to read. Without clean URLs, the links would be like this
http://host_domain/drupal/?q=admin/settings/clean-urls
which is hard to read, rite?

In addition, some Drupal modules required clean URLs. Therefore, enabling clean URLs is a key feature to make your Drupal application better.

here are the steps to enable the clean URLs feature

1. Check if the Apache mod_rewrite module is enabled
apache2ctl -M

2. Enable it if no mod_rewrite is found
a2enmod rewrite

3. Create /etc/apache2/conf.d/drupal.conf for the Drupal to work on Apache

<Directory /var/www/drupal>
        RewriteEngine on
        # Replace <drupal> with your drupal directory name
        RewriteBase /<drupal>
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

4. Restart apache
/etc/init.d/apache2 restart

5. Now you can enable the clean URLs on the Drupal administration panel

Enable Clean URLs
Enable Clean URLs

Done =)

Reference:

9 thoughts on “Drupal – Enable clean URLs”

  1. Guys,
    I have gone through this problem and you know what..it takes couple of days to configure I mean to understand and solve..

    All the above instruction is just fine..only the confusion part is..@ the line
    RewriteBase /drupal

    in the place of drupal..just replace your folder name.Thats it..
    Cheer!!
    Mith

    Like

  2. Thank you! Worked fine with me.
    (same feedback that mith495, you should write to change ‘drupal’ by the site directory name)

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.