참조: O'Reilly Apache Cookbook Jan. 2008 pdf
Rewriting a Hostname to a Directory
You want requests for http://bogus.example.com/ to be turned into requests for http://example.com/bogus/
To do this transparently, without a redirect:
RewriteEngine On
RewriteCond "%{HTTP_HOST}" "^([^.]+)\.example\.com$"
RewriteRule "(.*)" "/%1$1" [PT]
Apache2 module enable: $ sudo a2enmod rewrite