0

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.

1 Answer 1

1

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.

3
  • is there any configuration in your httpd conf or .htaccess files?
    – gary69
    Dec 9, 2021 at 18:56
  • 1
    Your vhost may need a <Directory> entry with Options FollowSymLinks in it @gary69
    – Clive
    Dec 9, 2021 at 19:53
  • 1
    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.
    – Jaypan
    Dec 10, 2021 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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