Drupal with clean urls on Apache

It's been a long time since I've tried to enable clean urls on my testing server, mainly because I use it for development purposes only.

Today I decided to enable it because I'm tired of using the "?q=".

First of all I enabled the rewrite module using the command "a2enmod rewrite".
The above command enables the rewrite module for apache. You still have to enable the use of the module for your site.

This can be done in two ways. You can add the configuration on your site file (/etc/apache2/sites-available) or you can configure apache to override it's settings using the .htaccess file.

You may have to use the second method in case you're using a hosting environment and you do not have access to apache's configuration. Your provider is most likely using the override settings of your .htaccess file.

After enabling the rewrite module, add the following on the <Directory> section of the configuration file of your site (e.g. /etc/apache2/sites-available/mysite):
        RewriteEngine on
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

If you want to use the second method, just add the configuration on your .htaccess file but be sure to add "AllowOverride All" on the site configuration.

Popular posts from this blog

Syslog Message Collection for OMS from sources that do not support the agent

How to Configure Message Forwarding on a Mailbox Level

IIS Client Certificate Revocation Check Disable