I've setup Drupal on my localhost and am now trying to enable clean URLs by following these instructions: http://drupal.org/node/134439
But it's not working...

The rewrite module is enabled:

~$ a2enmod rewrite
Module rewrite already enabled

I've added the following code to /etc/apache2/apache2.conf:

<Directory /var/www/drupal>
    AllowOverride all
</Directory>

What am I doing wrong?

Comments

Do you have Drupal's .htaccess file in the root directory of your site?

No, it seems I don't... (mustn't have copied it properly...)
I added it from a new download and everything's working again. Thanks nevets!

I had the same problem last night:
http://www.kobashicomputing.com/enabling-drupal-clean-urls

Looking at your directory, I assume you installed Drupal in /var/www/drupal
Your website, call it "foobar.com" is in /var/www
Your .htaccess is in /var/www

Based on that assumption your httpd.conf should be:

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
<Directory /var/www>
  AllowOverride All
  Options Indexes FollowSymLinks
  Order allow, deny
  Allow from all
</Directory>

Even though this is an old thread, i thought this might be helpful for someone. I had the same problem today and wasn't able to fix it with the above solutions. In some other threads i read that mod_rewrite has to be active. I made sure it was, but it still didn't work.

For the record here is how i got it working on my Mac (should be similar on any System).

I got my Drupal installation under /Users/myUsername/Sites/drupal/ which Apache serves at http://localhost/~myUsername/drupal/.
It seems that the user and folder names were the problem here.

After fumbling around with .htaccess (within the Drupal folder) for a while i found out that all works perfectly when i add this line:
RewriteBase /~myUsername/drupal/.

After this i could activate Clean URLs without any error messages.

excellent. i enable that on the .htaccess files within my localhost installs & i got clear url option. thanks!