Drupal 8 in a Virtual Machine and Multi-sites with subdirectories

Events happening in the community are now at Drupal community events on www.drupal.org.
merolhack's picture

I followed this tutorial(Drupal 7) but it not worked for me(Drupal 8):

Multi-site in subdirectories https://www.drupal.org/docs/7/multisite-drupal/multi-site-in-subdirectories

My Drupal is on a Virtual Machine with only access via IP, not hostname.

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?

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: