// $Id: OVERVIEW =========================================================== The subdomain module gives each OG group OR node author its own subdomain. EXAMPLE: assuming a base domain of "example.com" In OG mode, a group named "Pizza Lovers" & all its content would be located at: http://pizza-lovers.example.com In Node Author mode, a user named "Sayuko" and all her content would be located at: http://sayuko.example.com Subdomain currently supports 1st level subdomains. (e.g. example.com as a base domain and subdomain1.example.com, subdomain2.example.com, et cetera as subdomains). INSTALL =========================================================== STEP 1: Patch Drupal Core cd /path/to/drupal/includes/ patch < /path/to/subdomain/module/patch_subdomain_url_drupal_5.7.patch STEP 2: Enable wildcard DNS on your DNS hosting provider (e.g. *.example.com) STEP 3: Configure wildcard virtual hosts and URL rewriting on your webserver (see below for details on configuring Apache and Lighttpd. For other web servers, please consult those servers' documentation). STEP 4: If you're using the usernode.module and turning users into subdomains you'll need to apply the usernode patch at http://drupal.org/node/237012 and possibly upgrade to the latest pathauto (see http://drupal.org/node/225554). STEP 5: Configure the subdomain module's settings, select the mode of operation (Organic Groups or Node Authors), and the other options as desired. STEP 6: Configure pathauto, placing the [subdomain] token at the START of all nodetype 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 STEP 2: Patch Drupal's .htaccess file to rewrite subdomains cd /path/to_drupal/ patch < /path/to/subdomain/module/patch_subdomain_htaccess.patch 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