Joyent

Mapping sub-domain to sub-directory

There are at least 3 ways to map sub domains to sub directories (i.e. http://sub.name.tld to /home/name.tld/web/public/sub) using mod_vd, mod_vhost_alias or mod_rewrite. The following procedure uses mod_vhost_alias:

  1. Append to bottom of the file /opt/csw/apache2/etc/virtualhosts/domain.conf the code as shown bellow (abc is arbitrary)
  2. Repeat for every domain you would like to have this feature
  3. Restart Apache using Webmin.
<VirtualHost 8.11.22.123:80>
    ServerName abc.domain.com
    ServerAlias *.domain.com
    VirtualDocumentRoot /home/domain.com/web/public/%-3
</VirtualHost>
 
accelerators/kb/apache/subdomains.txt · Last modified: 2008/01/31 12:04 by alexbcoles
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki