You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/05/11 12:23:12 UTC

svn commit: r1337101 - /httpd/httpd/trunk/docs/manual/mod/mod_vhost_alias.xml

Author: humbedooh
Date: Fri May 11 10:23:12 2012
New Revision: 1337101

URL: http://svn.apache.org/viewvc?rev=1337101&view=rev
Log:
Added a portion about using the %-2.0.%-1.0 combination for managing virtual document roots.

Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_vhost_alias.xml

Modified: httpd/httpd/trunk/docs/manual/mod/mod_vhost_alias.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_vhost_alias.xml?rev=1337101&r1=1337100&r2=1337101&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_vhost_alias.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_vhost_alias.xml Fri May 11 10:23:12 2012
@@ -171,6 +171,25 @@ VirtualDocumentRoot /usr/local/apache/vh
     <p>The example request would come from
     <code>/usr/local/apache/vhosts/example.com/d/o/m/ain/directory/file.html</code>.</p>
 
+<p> A very common request by users is the ability to point multiple domains to multiple 
+document roots without having to worry about the length or number of parts of the 
+hostname being requested. If the requested hostname is <code>sub.www.domain.example.com</code>
+ instead of simply <code>www.domain.example.com</code>, then using %3+ will result in the document
+root being <code>/usr/local/apache/vhosts/domain.example.com/...</code> instead of the
+intended <code>example.com</code> directory. In such cases, it can be beneficial to use 
+the combination <code>%-2.0.%-1.0</code>, which will always yield the domain name and the 
+tld, for example <code>example.com</code> regardless of the number of subdomains appended 
+to the hostname. As such, one can make a configuration that will direct all first, second 
+or third level subdomains to the same directory:
+</p>
+<highlight language="config">
+    VirtualDocumentRoot "/usr/local/apache/vhosts/%-2.0.%-1.0"
+</highlight>
+<p>
+In the example above, both <code>www.example.com</code> as well as <code>www.sub.example.com</code>
+or <code>example.com</code> will all point to <code>/usr/local/apache/vhosts/example.com</code>.
+</p>
+
     <p>For IP-based virtual hosting you might use the following in
     your configuration file:</p>