Score:0

Multisite same host different basepaths

cn flag

I have a site for the virtual host example.com, the base directory for the drupal application is example.com/site1. I'd like to setup a multisite but have the sites only differ by the base path, not the host name. So the new site will be reached through example.com/site2, but it will use the code base in example.com/site1.

I've tried creating a symbolic link https://www.drupal.org/docs/7/multisite-drupal/multisite-mapping-with-drupal#multisite-drupal-by-subdomains-and-url-path ln -s site1 site2 but that gives a 404 when accessing example.com/site2

I've also tried setting up a multisite using this https://www.drupal.org/docs/multisite-drupal/set-up-a-multisite and an AliasMatch in the httpd.conf but this seems to want the sites to have different hostnames rather than different paths. I also get a 404 in this setup.

Is it possible to set up a multisite with the sites only differing by the basepath? I'm using Drupal 9.

Score:1
de flag

I'm working on a site that works like that now. I didn't set it up, but it's done as follows.

Sites:

  • example.com/eu
  • example.com/us
  • example.com/global

The webroot is at [PROJECT]/web.

The following symlinks were created:

  • [PROJECT]/web/eu => [PROJECT_WEB]
  • [PROJECT]/web/us => [PROJECT_WEB]
  • [PROJECT]/web/global => [PROJECT_WEB]

So as you can see, three symlinks were created from subfolders of the webroot, to the webroot. Then the the domain was set to point at the webroot. By doing this, when accessing for example example.com/eu, the server looks for the domain at [project]/web, then for the subfolder /eu, which is a symlink to the webroot, so Drupal sees it as a Drupal installation.

cn flag
is there any configuration in your httpd conf or `.htaccess` files?
cn flag
Your vhost may need a `<Directory>` entry with `Options FollowSymLinks` in it @gary69
Jaypan avatar
de flag
Gary: I don't know - I didn't set it up. It's very possible. I think at a minimum you will need to ensure that your server allows symlinks, as Clive has mentioned.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.