=========================================================== OVERVIEW =========================================================== The subdomain module joins forces with pathauto to automatically place Drupal site content onto subdomains. Currently, it supports 4 modes: Node Author: EXAMPLE: A user named "Sayuko" and her content would be located at: http://sayuko.example.com Node Content Type: EXAMPLE: Nodes with a content type of "News" would have URLs like http://news.example.com/drupal-is-the-greatest-web-tool-ever Organic Groups: EXAMPLE: A group named "Pizza lovers" & content would be located at: http://pizza-lowers.example.com Taxonomy: EXAMPLE: A term named "Seattle" & associated content would be located at: http://seattle.example.com =========================================================== UPGRADING FROM 5.x-1.5 OR PREVIOUS VERSIONS =========================================================== remove all customizations you made to install the old subdomain module, including: - changes to .htaccess - changes to common.inc - changes to settings.php =========================================================== INSTALL =========================================================== STEP 1: Patch includes/common.inc cd /path/to/drupal/includes/ patch < /path/to/subdomain/module/patches/common.inc.patch STEP 2: Edit settings.php & set $cookie_domain to your site domain. e.g.: $cookie_domain = "example.com"; NOTE: be sure and uncomment the $cookie_domain line by removing the "#" that prefixes it STEP 3: Paste the following to the bottom of your settings.php file: /*********** BEGIN COPYING FROM BELOW THIS LINE ***********/ /** * Backport of Drupal 6.x custom_url_rewrite_outbound * Used by subdomain module to rewrite outgoing URLs */ function custom_url_rewrite_outbound(&$path, &$query, &$fragment, &$absolute, &$base_url, $original_path) { if (module_exists('subdomain')) { // extract subdomain from $path if present and add to $base_url subdomain_url_rewrite_outbound($path, $base_url, $absolute); } } /** * Implementation of custom_url_rewrite * Used by the Subdomain module to rewrite incoming URLs */ function custom_url_rewrite($op, $result, $path) { if ($op == 'source') { if (!function_exists('subdomain_url_rewrite_inbound')) { drupal_load('module', 'subdomain'); } return subdomain_url_rewrite_inbound($path); } return $result; } /*************** COPY UNTIL THIS LINE ******************/ 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: 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 7: Enable subdomain module and configure its settings: select mode (og, node author, taxonomy vocabulary) and additional settings as desired STEP 8: Configure pathauto settings: 1) Go to "Punctuation Settings" and set "Tilde ~:" 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/" } =========================================================== CREDITS =========================================================== Authored and maintained by Stein Setvik