tags:

views:

545

answers:

5

I'm trying to map help.domain1.com to help.domain2.com. I've seen this on UserVoice. They let you map something.yourdomain.com to something.uservoice.com.

On domain1.com I've set up a CNAME to help.domain2.com.

It works fine but when I open help.domain1.com I get the content of domain2.com instead of help.domain2.com.

After some experimenting I've realized that this is an expected behavior.

So my question is what do I have to do on domain2.com (or maybe on domain1.com?) to have it show content of subdomain "help.domain2.com" when I navigate help.domain1.com?

(I'm using Plesk and the OS is Windows Server 2003)

A: 

HTTP/1.1 uses the Host: header to figure out which site is being requested, should there be more than one site hosted on the same IP address.

You need to ensure that the second (target) web-server is configured to expect incoming HTTP requests with the original URI in them.

Alnitak
A: 

I found the solution. One way would be to use a mod_rewrite rule on domain2.com and do a redirect if referrer is domain1.com. Or to assign a dedicated IP address.

Davorin
A: 

I am not 100% sure how to do this in windows but in apache you just need to setup a virtual host to redirect it from the main domain to your subdomain.

you do not say if you are using IIS or apache or what the webserver is.

I imagine that what you need to do is setup a new website in IIS (not a virtual directory) and in the website tab click on advanced and edit the entry in there so that the "host header name" is the subdomain you want.

Jon Hawkins

Jon
A: 

Can you please let me know how your write the mod_rewrite rule?

I have tried to write the following in .htaccess on domain2.com but it doesn't work.

Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_REFERER} ^http://help.domain1.com RewriteRule ^/(.*)$ http://help.domain2.com/ [L,R=301]

Many thanks!

Vincent Chan
A: 

I was facing the same problem for the last couple of days, and just found the solution...

In /etc/apache2/site-available/default, I had two virtual hosts, first one was for my domain, and the second one was for my sub domain. All I had to do was reverse the order of the virtual host blocks, placing the sub domain in front of the domain, and it worked! :D

AAA

related questions