0

I know how to create a sub domains for Drupal website (I create a sub domain and add its folder in /sites folder). Out websites are multilingual so for every language I create a subdomain and in the end the sites are going to be like this :

  1. fr.example.com
  2. en.example.com
  3. ar.example.com

and so on. we have also a few sites that are subset of our main website and we want to display them like this

fr.subset1.example.com

en.subset1.example.com

ar.subset1.example.com

fr.subset2.example.com

en.subset2.example.com

is it possible to implement such thing in Drupal 7?

1 Answer 1

1

The answer is "yes". A Drupal multisite can use whatever structure it likes, including the one you propose.

To do this for subdomain http://fr.subset1.example.com/ just create the following subdrectory sites/fr.subset1.example.com/. Make sure it contains the file default.setttings.php and a copy this to settings.php. Then create subdirectories files (and optionally, modules and themes), and make sure they're all writable by the web-server user.

Then:

  1. Set up DNS for this subdomain (fr.subset1.example.com) to point to the same IP as the default domain.

  2. Create a serveralias (details below) (or vhost entry) for that directory that has the same web root as the default domain.

  3. Point your browser to the base URL of your website (http://fr.subset1.example.com/) to complete the web based part of the installation of a Drupal site.

To create a multi-site instance, you also need to make sure the DNS for that instance points to the same web root as the default domain. If you've set up a sub-domain, the simplest way to do this is to add it as a ServerAlias. This means putting something like this in the Apache vhost configuration:

<VirtualHost *>
  ServerName example.com
  ServerAlias fr.example.com
  ServerAlias fr.subset1.example.com
  …
  DocumentRoot /var/www/example.com/htdocs/
  …
</VirtualHost *>

Alternatively, you may create a separate vhost for the multi-site. This requires a separate entry, but allow you to tailor the web server settings for this particular multi-site instance.

Repeat this procedure for any other subdomains you want.

2
  • How? from what I know websites placed in /sites folder have only files , modules and themes . besides that how does Cpanel add sub domain to a sub domain?
    – M a m a D
    May 3, 2014 at 8:10
  • @Drupalist, for user support for Cpanel, ask your hosting provider. Cpanel has nothing to do with Drupal. May 3, 2014 at 8:36

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.