Enabling Clean URLs

I though that i had posted this proc months ago until i went looking for it and couldn’t find it. so here is the proc that i used to enable clean urls on drupal 7.17 on ubuntu desktop 12.04

Procedure – Enable clean URLs for Drupal 7 on Ubuntu Desktop 12_04 rev_1.doc

Date: 11/13/2012

Author: PJ McGhee

Email: PJMcGhee@hotmail.com

Procedure: New

Replace Existing

Intended Audience: Drupal admins

Purpose: To explain the steps needed to enable clean URLs in Drupal by enabling the rewrite_module component and changing the httpd.conf file of Apache2 to

Web References:




  1. Navigate to the Configuration, Search and Metadata section of Drupal.
  2. Click Clean URLs.
  3. In Drupal 7 the test will be run automatically and will give the result right away.
  4. When the test fails take a good look at the links above for background on the issue.
  5. Then, on this particular install, since you are running a dedicated server, you can do this first.
  6. At the command line, type apache2ctl –M and hit enter.
  7. Look for rewrite_module (shared) you should not see it (that’s to be expected)
  8. Type a2enmod rewrite and hit enter.
  9. Type apachectl –M again, hit enter. Now you should see the module listed there.
  10. Go to etcapache2 and edit the httpd.conf file which should be empty.
  11. Add the lines:

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

  1. In this scenario, the directory structure shown is correct, but it should reflect where you actually have Drupal installed.
  2. Then type sudo /etc/init.d/force-reload and hit enter.
  3. Then type sudo /etc/init.d/apache2 restart and hit enter.
  4. Then test clean URLs in Drupal.
  5. You should now see a check box that will allow you to enable this feature.

Clean URLs

well, i blew up my drupal install yesterday and had to drop my db, recreate it and reinstall. and that caused me to focus on something that i haven’t given enough attention to. clean urls. so now i am learning more about apache, .htaccess, apache2.conf, httpd.conf and the mod rewrite concepts. it feels like a step back but a good one in a way because i am having to learn some stuff about linux that i probably should know as an infrastructure guy. so we’ll see where it goes.