Soumis par ikino le lun 15/10/2018 - 09:06 followed this tutorial(Drupal 7) but it not worked for me(Drupal 8):

    This is my enviroment:

    • CentOs 7 with SELinux(mode: enforcing)
    • Varnish 4.0.3
    • Apache 2.4.23
    • Drupal 8.2.4

    I need to create the next structure of sites:

    • / <-- First site
    • /site2 <-- Second site
    • /site3 <-- Third site

    In the file sites/sites.php i have:

    $sites['localhost.site2'] = 'site2';
    $sites['localhost.site3'] = 'site3';

    In the directory sites/ i have:

    • default/
    • site2.localhost
    • site3.localhost

    In the root of the drupal o have the next symlinks to .:

    • site2 -> .
    • site3 -> .

    In my .htaccess file i have:

      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} ^/site2/(.*)$
      RewriteRule ^(.*)$ /site2/index.php [L,QSA]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} ^/site3/(.*)$
      RewriteRule ^(.*)$ /site3/index.php [L,QSA]

    When i tried to access to each subsite, he shows me the default. What is wrong?

    • Download latest D8 version.
    • Extract and navigate into the directory: /drupal/sites/
    • Create sites.php duplicating example.sites.php
    • Add the code to sites.php

      $sites = array( 'dogs.multisite.local' => 'dogs', 'multisite.local.cats' => 'cats', );

    • Create two folders named 'cats' and 'dogs' on the sites folder.

    • The /drupal/sites/default/ site will have default files we need to copy into each of our sites. Copy these files using the cp command in the sites directory:

      cp default/default.settings.php dogs/settings.php
      cp default/default.settings.php cats/settings.php    
      cp default/ dogs/services.yml
      cp default/ cats/services.yml
    • Setup virtualhost

      hosts  multisite.local


      <VirtualHost *:80>
      ServerAdmin webmaster@multisite.local
      DocumentRoot "/opt/lampp/htdocs/drupal"
      ServerName multisite.local
      ServerAlias    *.multisite.local multisite.local.*
      ErrorLog "logs/multisite.local-error_log"
      CustomLog "logs/multisite.local-access_log" common
    • Once it is done, you can start the installation of your new website in a multisite context from the urls:


    shareimprove this answer

    answered Dec 21 '16 at 5:36



    • I tried to do it only with the IP of the Virtual Machine, but it dont work. I need to do it with the hostname. Thanks for your help! – Lenin Meza Dec 21 '16 at 15:39

    add a comment

    I suggest you to use drush. It will make your life way easier:

    $ drush site-install --db-url=mysql://db_user:db_password@ --yes

    Please note that drush will generate all the proper config for you. Then you can check how it is actually when you want to go "manual".

    And here you have a full list of steps to setup a Multisite on Drupal 8

    shareimprove this answer