Clean URL at Drupal 8 with Apache and IspConfig, in a Debian 8 server

Clean URL at Drupal 8 with Apache and IspConfig, in a Debian 8 server

Our target is our server to enable by default clean URL at any Drupal 8 project.

If you've installed IspConfig opensource project, you probably have Apache mod_rewrite enabled. This is one of requirements. Then, you just should edit /etc/apache2/apache2.conf file and add there:

# Drupal 8: clean URL
# https://www.drupal.org/getting-started/clean-urls#comment-8780263
<Directory /var/www/clients/*/*/web/>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

Pay attention at path wildcard: /var/www/clients/*/*/web/ what let us apply this settings to further web projects at server.

After it, you should restart  Apache service, to enable changes for Apache daemon:

service apache2 restart

And you get it!

 

20151127 Update:

In a seconfd fresh install in the same server, it seems clean url are not enables. I've solved it adding these lines to local .htaccess:

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

 

joan