0N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0N/A<
TITLE>Apache module mod_vhost_alias</
TITLE>
0N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 0N/A Apache HTTP Server Version 1.3
0N/A<
H1 ALIGN="CENTER">Module mod_vhost_alias</
H1>
1879N/Aand is not compiled in by default. It should be mentioned near the
1879N/Astart of the <
CODE>Configuration</
CODE> file so that it doesn't
1879N/Aoverride the behaviour of other modules that do filename translation,
1504N/A<
H2>Directory Name Interpolation</
H2>
0N/AAll the directives in this module interpolate a string into a
0N/Apathname. The interpolated string (henceforth called the "name") may
0N/Abe either the server name (see the
0N/A<
A HREF="core.html#usecanonicalname"><
CODE>UseCanonicalName</
CODE></
A>
0N/Adirective for details on how this is determined) or the IP address of
0N/Athe virtual host on the server in dotted-quad format. The
0N/Ainterpolation is controlled by specifiers inspired by
0N/A<
CODE>printf</
CODE> which have a number of formats:
0N/A <
DD>insert a <
CODE>%</
CODE>
1504N/A <
DD>insert the port number of the virtual host
0N/A <
DD>insert (part of) the name
0N/A<
CODE>N</
CODE> and <
CODE>M</
CODE> are used to specify substrings of
0N/Athe name. <
CODE>N</
CODE> selects from the dot-separated components of
0N/Athe name, and <
CODE>M</
CODE> selects characters within whatever
0N/A<
CODE>N</
CODE> has selected. <
CODE>M</
CODE> is optional and defaults
0N/Ato zero if it isn't present; the dot must be present if and only if
0N/A<
CODE>M</
CODE> is present. The interpretation is as follows:
0N/A <
DD>the penultimate part
0N/A <
DD>the second and all subsequent parts
0N/A <
DT><
CODE>-2+</
CODE>
0N/A <
DD>the penultimate and all preceding parts
0N/A <
DT><
CODE>1+</
CODE> and <
CODE>-1+</
CODE>
0N/A <
DD>the same as <
CODE>0</
CODE>
0N/AIf <
CODE>N</
CODE> or <
CODE>M</
CODE> is greater than the number of
0N/Aparts available a single underscore is interpolated.
0N/AFor simple name-based virtual hosts you might use the following
0N/Adirectives in your server configuration file:
0N/A UseCanonicalName Off
0N/Awill be satisfied by the file
0N/AFor a very large number of virtual hosts it is a good idea to arrange
0N/Athe files to reduce the size of the <
CODE>vhosts</
CODE> directory. To
0N/Ado this you might use the following in your configuration file:
0N/A UseCanonicalName Off
0N/Awill be satisfied by the file
0N/AA more even spread of files can be acheived by hashing from the end of
0N/Athe name, for example:
0N/A VirtualDocumentRoot /u/%3+/%2.-1/%2.-2/%2.-3/%2
0N/AThe example request would come from
0N/AAlternatively you might use:
0N/AThe example request would come from
0N/AFor IP-based virtual hosting you might use the following in your
0N/A UseCanonicalName DNS
0N/Awould be satisfied by the file
0N/Awould be satisfied by executing the program
0N/A<
CODE>%V</
CODE> and <
CODE>%A</
CODE> are useful in conjunction with
0N/A <
LI><
A HREF="#VirtualDocumentRoot">VirtualDocumentRoot</
A>
0N/A <
LI><
A HREF="#VirtualDocumentRootIP">VirtualDocumentRootIP</
A>
0N/A <
LI><
A HREF="#VirtualScriptAlias">VirtualScriptAlias</
A>
0N/A <
LI><
A HREF="#VirtualScriptAliasIP">VirtualScriptAliasIP</
A>
0N/A<
H2><
A NAME="VirtualDocumentRoot">VirtualDocumentRoot directive</
A></
H2>
0N/A><
STRONG>Syntax:</
STRONG></
A> VirtualDocumentRoot <
EM>interpolated-directory</
EM><
BR>
0N/A><
STRONG>Default:</
STRONG></
A> None<
BR>
0N/A><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
0N/A><
STRONG>Status:</
STRONG></
A> Extension<
BR>
0N/A><
STRONG>Module:</
STRONG></
A> mod_vhost_alias<
BR>
0N/A><
STRONG>Compatibility:</
STRONG></
A> VirtualDocumentRoot is only available in 1.3.5 and later.</
P>
0N/AThe <
CODE>VirtualDocumentRoot</
CODE> directive allows you to determine
0N/Awhere Apache will find your documents based on the value of the server
0N/Aname. The result of expanding <
EM>interpolated-directory</
EM> is used
0N/Aas the root of the document tree in a similar manner to the
0N/A<
A HREF="core.html#documentroot"><
CODE>DocumentRoot</
CODE></
A>
0N/Adirective's argument. If <
EM>interpolated-directory</
EM> is
0N/A<
CODE>none</
CODE> then <
CODE>VirtaulDocumentRoot</
CODE> is turned off.
0N/AThis directive cannot be used in the same context as
0N/A<
A HREF="#VirtualDocumentRootIP"><
CODE>VirtualDocumentRootIP</
CODE></
A>.
0N/A<
H2><
A NAME="VirtualDocumentRootIP">VirtualDocumentRootIP directive</
A></
H2>
0N/A><
STRONG>Syntax:</
STRONG></
A> VirtualDocumentRootIP <
EM>interpolated-directory</
EM><
BR>
0N/A><
STRONG>Default:</
STRONG></
A> None<
BR>
0N/A><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
0N/A><
STRONG>Status:</
STRONG></
A> Extension<
BR>
0N/A><
STRONG>Module:</
STRONG></
A> mod_vhost_alias<
BR>
0N/A><
STRONG>Compatibility:</
STRONG></
A> VirtualDocumentRootIP is only available in 1.3.5 and later.</
P>
0N/AThe <
CODE>VirtualDocumentRootIP</
CODE> directive is like the
0N/A<
A HREF="#VirtualDocumentRoot"><
CODE>VirtualDocumentRoot</
CODE></
A> directive,
0N/Aexcept that it uses the IP address of the server end of the connection
0N/Ainstead of the server name.
1295N/A<
H2><
A NAME="VirtualScriptAlias">VirtualScriptAlias directive</
A></
H2>
1295N/A><
STRONG>Syntax:</
STRONG></
A> VirtualScriptAlias <
EM>interpolated-directory</
EM><
BR>
0N/A><
STRONG>Default:</
STRONG></
A> None<
BR>
0N/A><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
0N/A><
STRONG>Status:</
STRONG></
A> Extension<
BR>
0N/A><
STRONG>Module:</
STRONG></
A> mod_vhost_alias<
BR>
0N/A><
STRONG>Compatibility:</
STRONG></
A> VirtualScriptAlias is only available in 1.3.5 and later.</
P>
0N/AThe <
CODE>VirtualScriptAlias</
CODE> directive allows you to determine
0N/Awhere Apache will find CGI scripts in a similar manner to
0N/A<
A HREF="#VirtualDocumentRoot"><
CODE>VirtualDocumentRoot</
CODE></
A>
0N/Adoes for other documents. It matches requests for URIs starting
1739N/A<
CODE>/cgi-bin/</
CODE>, much like
0N/A<
H2><
A NAME="VirtualScriptAlias">VirtualScriptAliasIP directive</
A></
H2>
0N/A><
STRONG>Syntax:</
STRONG></
A> VirtualScriptAliasIP <
EM>interpolated-directory</
EM><
BR>
0N/A><
STRONG>Default:</
STRONG></
A> None<
BR>
0N/A><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
0N/A><
STRONG>Status:</
STRONG></
A> Extension<
BR>
0N/A><
STRONG>Module:</
STRONG></
A> mod_vhost_alias<
BR>
0N/A><
STRONG>Compatibility:</
STRONG></
A> VirtualScriptAliasIP is only available in 1.3.5 and later.</
P>
0N/AThe <
CODE>VirtualScriptAliasIP</
CODE> directibe is like the
0N/A<
A HREF="#VirtualScriptAlias"><
CODE>VirtualScriptAlias</
CODE></
A> directive,
0N/Aexcept that it uses the IP address of the server end of the connection
0N/Ainstead of the server name.
0N/A Apache HTTP Server Version 1.3