Enable Drupal URL cleaner

Thanks to James Michael Dupont I was able to enable my Drupal’s Site Url cleaner.
Actually first you have to enable mod_rewrite module, than edit your virtual host so that
it includes the .htaccess file, than edit your .htaccess file and reload apache.

What you should do first is enable mod_rewrite module

# a2enmod rewrite

Than to make it easier to work edit change .htaccess to htaccess.conf on your drupal folder (mine: /var/www/drupal-7.0)

# mv /var/www/drupal-7.0/.htaccess /var/www/drupal-7.0/htaccess.conf

Before including some lines on your vhost go to /var/log/apache2/ and create some log files:

# touch drupal7-rewrite.log drupal_access.log  drupal_error.log  drupal-rewrite.log

So now you have to include htaccess.conf in your vhost, by adding these lines:

RewriteLog "/var/log/apache2/drupal7-rewrite.log"
RewriteLogLevel 3
and also "Include /var/www/drupal-7.0/htaccess.conf"

Example your vhost would look like this:

Ok now you add this to your htaccess.conf file under the Rewrite Base:

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

So your htaccess.conf would look like this:

Now reload apache and go to your web-browser and type
and Tick the checkbox > Save your configuration and you’re good to go !

Hope I helped you, thanks to JMD again 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s