Forum Moderators: phranque
I am using the following to host multiple sub-domains (sub1.domain.com etc.)
in httpd.conf:
<VirtualHost XX.XX.XX.XX:80>
VirtualDocumentRoot /var/www/vhosts/%0
........................
Now I want to map www.mappeddomain.com to sub1.domain.com. I got the first step - added CNAME record in registrar's DNS.
I thought to use RewriteMap and RewriteRule, but puzzled how to do it.
Any help would be appreciated!
Thanks,
Michael
You can either redirect all requests for www.mappeddomain.com to sub1.domain.com, which will cause search engines to remove www.mappeddomain.com from their search results and substitute sub1.domain.com, or you can simply serve all requests for resources in www.mappeddomain.com from the file directory /var/www/vhosts/sub1.domain.com.
In the former case, search engines and humans using browsers will see the URL change from www.mappeddomain.com to sub1.domain.com, while in the second case, the domain will be unchanged, and only the association between that domain and the file directory used to serve its content will change.
Jim
I added the following at the registrar:
www.mappeddomain.com CNAME sub1.domain.com
So I just want to serve www.mappeddomain.com with the content from directory /sub1.domain.com. I could rename sub1.domain.com > www.mappeddomain.com, but I want to be able to serve [sub1.domain.com...] as well.
Because of this line in httpd.conf
<VirtualHost XX.XX.XX.XX:80>
VirtualDocumentRoot /var/www/vhosts/%0
Apache will look for directory /www.mappeddomain.com which doesn't exists so it needs to be redirected to /sub1.domain.com.
Thanks,
Michael