Forum Moderators: phranque

Message Too Old, No Replies

Multiple virtual hosts, domain mapping and RewriteMap - help please!

         

mberd

3:22 am on Mar 26, 2008 (gmt 0)

10+ Year Member



Hi,

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

jdMorgan

1:22 pm on Mar 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What do you mean by "I want to map www.mappeddomain.com to sub1.domain.com"?

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

mberd

2:14 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



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