0

I have a Drupal multi-site setup on Ubuntu.

One of the multi-sites is cyber.site.edu.

Our requirement is to have another virtul host named cyber1.site.edu.

cyber1.site.edu should also resolve to cyber.site.edu

Can I use example.sites.php? I read the documentation at this link but it is not clear to me.

Any help would be appreciated.

1
  • You will do most of your set up with your server: Apache, IIS, etc. Your settings.php file will be in your site specific folder i.e. sites/cyber1.site.edu/settings.php Here you will define your db etc.
    – sareed
    Aug 28, 2015 at 22:37

1 Answer 1

0

This assumes your multi-site structure is as follows:

sites/site.edu  
sites/cyber.site.edu

Let's start at the top by addressing a few key things:

1. Is there a DNS entry for your subdomain?

When working locally, you should add the subdomain to your hosts file.

Hint: If browsing to cyber1.site.edu generates "This webpage is not available", the answer is no.

Help: (AskUbuntu) Setting up subdomain on Ubuntu server

2. Have your Virtual Hosts been properly configured?

You need to inform Apache how to pass the correct domains to Drupal.

Hint: If browsing to cyber1.site.edu generates a Drupal site installation page, the answer is no.

Help: How To Enable Multiple Sites on a Drupal Installation On Ubuntu 12.04

3. Do you have a folder in sites/ bearing the actual hostname, including the subdomain?

In this case, we already know the answer is no. If the answer were yes and you had a folder in sites/ named cyber1.site.edu then Drupal would be able to auto-discover it in the usual way. Since you do not, we need to tell Drupal what to do.

This is where sites.php comes in handy:


Setting up sites.php

From the docs in sites/example.sites.php:

This file allows you to define a set of aliases that map hostnames and pathnames to configuration directories. These aliases are loaded prior to scanning for directories, and they are exempt from the normal discovery rules. (...)

To use this file, copy and rename it such that its path plus filename is 'sites/sites.php'.

Add this line to the end of the file and save.

$sites['cyber1.site.edu'] = 'cyber.site.edu';

Your Answer

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

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