# Rewrite document-root to /sub/ according to the provided sub.domain.tld RewriteCond %{HTTP_HOST} ^(.*)((\.[a-z0-9-]+){2}) [NC] RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/icons/ RewriteRule (.*) %{DOCUMENT_ROOT}%1$1 [L]