===========================================================
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
===========================================================
UPGRADING FROM Beta 1
===========================================================
STEP 1: reverse previous common.inc patch
cd /path/to/drupal/includes/
patch -r /path/to/subdomain/module/patches/OLD_common.inc.patch
STEP 2: Proceed through INSTALL procedure and
1) perform steps 1, 3, and 7
2) double check other steps to make sure you've got them
squared away as well (you most likely already do)
===========================================================
INSTALL
===========================================================
STEP 1: Patch includes/common.inc
cd /path/to/drupal/includes/
patch < /path/to/subdomain/module/patches/common.inc.patch
STEP 2: Patch .htaccess
cd /path/to/drupal/
patch < /path/to/subdomain/module/patches/htaccess.patch
STEP 3: Patch settings.php
cd /path/to/drupal/sites/default/
patch < /path/to/subdomain/module/patches/settings.php.patch
STEP 4: Edit settings.php & set $cookie_domain to your site domain. e.g.:
$cookie_domain = "example.com";
STEP 5: Enable wildcard DNS on your DNS hosting provider (e.g. *.example.com)
STEP 6: Configure wildcard virtual hosts. For apache or lighttpd,
see below. For other web servers, consult their documentation.
STEP 7: IF using subdomain in Node Author mode as well as the usernode module
You'll need to do 2 things to ensure that subdomains generate correctly:
1) Update to usernode-5.x-1.4 or later (see http://drupal.org/node/237012)
2) Update to pathauto-5.x-2.2 or later (see http://drupal.org/node/225554).
STEP 8: Enable subdomain module and configure its settings:
select mode (og, node author, taxonomy vocabulary)
and additional settings as desired
STEP 9: Configure pathauto 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