0

I am having a Drupal 8 multisite installation:

  • Hostname: example.com
  • 1st Drupal site: in example.com
  • 2nd Drupal site: in example.com/sub/path

I have configured this in sites.php:

$sites['example.com.sub.path'] = 'subpath.example.com';
$sites['example.com'] = 'example.com';

The directories example.com and subpath.example.com contain the corresponding settings.php, setting.local.php, etc files.

Additionally, I have added this to the apache configuration (apache 2.4):

DocumentRoot /var/drupal
Alias /sub/path /var/drupal
Alias / /var/drupal
  <Directory /var/drupal/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Include /var/drupal/.htaccess
  </Directory>

The site example.com works as expected. I could install the site example.com/sub/path, but I now can just go to the home page. Every sub-page goes instead to the example.com configuration and gives an appropriate 404 error.

What did I do wrong/overlook?

Any help greatly appreciated!

1
  • In drupal.stackexchange.com/questions/223525/… they recommended to add a rewrite condition into the .htaccess file. This fixes the problem. However, I will have to patch .htaccess every time I upgrade Drupal core. Is there another way to do it, or is this the recommended solution? RewriteCond %{REQUEST_URI} ^/sub/path/(.*)$ RewriteRule ^(.*)$ /sub/path/index.php [L,QSA]
    – Ursula
    May 15, 2017 at 15:07

1 Answer 1

0

Adding a rewrite rule into the .htaccess file fixes the problem. Without the rewrite rule for this path, the default rewrite rule goes into effect, pointing to the example.com/index.php instead of example.com/sub/path/index.php.

Disadvantage: I will have to patch .htaccess every time I upgrade Drupal core.

RewriteCond %{REQUEST_URI} ^/sub/path/(.*)$ 
RewriteRule ^(.*)$ /sub/path/index.php [L,QSA]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.