I have a domain on my server (on its own virtualhost), e.g. domain.com, which has a lot of subdomains with content on it.
sub1.domain.com
sub2.domain.com
This virtualhost looks like this:
ServerAdmin
[email protected]
ServerName domain.com
ServerAlias *.domain.com
DocumentRoot /var/www/domain.com/public_html/
I want to put other domains on the server and have each of them link to a specific subdomain on domain.com. I don't want it to redirect. I want a similar behavior as the [L,PT] flags on mod rewrite.
I've tried this:
ServerName otherdomain.com
ReWriteEngine on
RewriteCond %{HTTP_HOST} ^otherdomain.com$ [NC]
RewriteRule ^(.*)$ http://sub1.domain.com/$1 [PT,L]
But it is giving me a 400 Bad request error.
How would I configure such a virtualhost?