/ Published in: Apache
Add to vhost block. Dynamically maps all subdomains of sub.example.com to their respective document root. Note: Doesn't work great when the sub sub needs to add additional mod_rewrite rules of its own, i.e., a Drupal installation.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
ServerAlias *.sub.example.com RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?(.+)\.sub\.example\.net RewriteCond /Users/username/Sites/sub/%2/httpdocs -d RewriteRule ^(.*) /%2/httpdocs/$1 [L]