===========================================================
OVERVIEW
===========================================================
The subdomain module joins forces with pathauto to automatically
place Drupal site content onto subdomains.
Currently, it supports 3 modes:
OG - place organic groups & content onto subdomains
EXAMPLE: A group named "Pizza lovers" & content would be located at:
http://pizza-lowers.example.com
Node Author - place node author & content onto subdomains
EXAMPLE: A user named "Sayuko" and her content would be located at:
http://sayuko.example.com
Vocabulary - place a vocabulary's terms & associated content onto subdomains
NOTE: only non-hierarchical vocabularies are supported
EXAMPLE: A term named "Seattle" & associated content would be located at:
http://seattle.example.com
===========================================================
INSTALL
===========================================================
STEP 1: Patch .htaccess (Apache only. For lighttpd, see below)
cd /path/to/drupal/
patch < /path/to/subdomain/module/patches/htaccess.patch
STEP 2: Patch settings.php
cd /path/to/drupal/sites/default/
patch < /path/to/subdomain/module/patches/settings.php.patch
STEP 3: Edit settings.php & set $cookie_domain to your site domain. e.g.:
$cookie_domain = "example.com";
STEP 4: Enable wildcard DNS on your DNS hosting provider (e.g. *.example.com)
STEP 5: Configure wildcard virtual hosts. For apache or lighttpd,
see below. For other web servers, consult their documentation.
STEP 6: Enable Subdomain settings (URL aliases -> Subdomain settings
select mode (og, node author, taxonomy vocabulary)
and additional settings as desired
STEP 7: Configure Pathauto (URL aliases -> Automated alias settings):
1) Go to "Punctuation Settings" and set "Underscore _:" to "No action"
2) Place [subdomain] at the *start* of all paths whose content you
want placed on a subdomain
===========================================================
CONFIGURING APACHE
===========================================================
STEP 1: Edit httpd.conf, enable mod_rewrite and configure
wildcard virtual hosts. An example configuration that you
can append to your httpd.conf is below. Replace the domain
name and directory as appropriate, save, and restart apache.
NameVirtualHost *:80
ServerAdmin webmaster@example.com
DocumentRoot /var/www/html
ServerName example.com
ServerAlias *.example.com
AllowOverride All
===========================================================
CONFIGURING LIGHTTPD
===========================================================
STEP 1: Enable wildcard DNS on your DNS hosting provider
(e.g. *.example.com)
STEP 2: Edit your lighttpd.conf file, enable the evhost module,
and append the following, modifying directories as appropriate:
$HTTP["host"] =~ "([^.]+)\.([^.]+)$" {
evhost.path-pattern = "/var/www/%2.%1/html/"
}
# Apply the following drupal rewrite rules to subdomain URLs
# moving subdomain to the 1st argument in the path
# e.g. bob.example.com news.mysite.net
$HTTP["host"] =~ "^([^.]+)\.([^.]+)\.([^.]+)$" {
url.rewrite-final = (
# More than one argument
"^/([^.?]*)\?(.*)$" => "/index.php?q=_%1/$1&$2",
# No arguments
"^/([^.?]*)$" => "/index.php?q=_%1/$1",
)
}
===========================================================
CREDITS
===========================================================
Authored and maintained by Stein Setvik