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

6,922

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
    </Directory>
    
  3. service apache2 restart

This is working for me...

Share:
6,922

Related videos on Youtube

JPO
Author by

JPO

Updated on September 18, 2022

Comments

  • JPO
    JPO over 1 year

    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 :

    https://www.howtoforge.com/tutorial/how-to-install-drupal_8-with-apache-and-ssl-on-ubuntu-15-10/

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

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

    Any help ? Thanks

    • Evan Genest
      Evan Genest almost 3 years
      I would only add it is helpful also first to first check which modules are already enabled in Apache: sudo apache2ctl -t -D DUMP_MODULES