Ubuntu – How to enable clean url with Ubuntu 16.04, Drupal 8.1.10 and Apache 2


I'm trying to install Drupal 8.1.10 on a virtual private server (OVH) with Ubuntu 16.04, Apache 2 and PHP7. I followed this tutorial :


I'm stucked at the requirement level. Drupal tells me that clean url are not enabled. I've added this to both my apache2.conf and my drupal.conf :

<Directory "/var/www/drupal">
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted

            RewriteEngine on
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteCond %{REQUEST_URI} !=/favicon.ico
                RewriteRule ^ index.php [L]

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars

Still does not work. I've been searching what's wrong for hours but I could not find a solution.

Any help ?

Best Answer

Use below process to enable clean url with Ubuntu 16.04:

  1. Enable apache mode rewrite -

    a2enmod rewrite
  2. put below code into /etc/apache2/sites-available/000-default.conf

    <Directory /var/www/html>
     Allowoverride All
  3. service apache2 restart

This is working for me...

Related Question