Using Drupal domain module (Best Practices)

Drupal multisite feature allows you to setup more than one website on a single Drupal installation. Literally, you have for example, your main site at sites/default, you can have another site, say example.com, at sites/example.com.

 

As the list of the sites included in the sites directory increases you find out that managing this domains manually is a hard thing to do. This is where the domain module comes in handy.

 

The following is a list of some known requirements and best practices of the domain module. This list is useful whether you are on a shared server or dedicated server.

  • use the default site folder for your primary domain.
  • Include settings.inc before enabling the Domain module: Before installing the domain module make sure you have included the settings.inc file in the settings.php file of the domain you are configuring (for example, your primary domain which is the default).
  • Set the document root: Set the document root of your other sites to the document root of your primary domain.
  • Write a rewrite rule: If on a shared server, write a rewrite rule in .htaccess file to redirect users to your other domains. If you have access to http.conf file, you can manually set the redirection here(within the <VirtualHost></VirtualHost>) instead of using a rewrite rule.
  • use private download method: The major advantage of using a private download method is that it allows a relative filepath for all the sites managed by the domain module. Practically, this means that all your files are managed from a single location.

The above list is a tested configuration on more than one Drupal websites. So feel free to comment below if you have any doubts or contributions.

 

Post new comment

The content of this field is kept private and will not be shown publicly.