<p>I have 2 hosts and I would like to point a subdomain on host one to a subdomain on host two:</p>

<pre><code>subdomain.hostone.com --&gt; subdomain.hosttwo.com
</code></pre>

<p>I added a CNAME record to host one that points to subdomain.hosttwo.com but all I get is a '<strong>400 Bad Request</strong>' Error.</p>

<p>Can anyone see what I'm doing wrong?</p>

[{'answer_id': 16307, 'author': 'Nick Berardi', 'author_id': 17, 'author_profile': 'https://Stackoverflow.com/users/17', 'pm_score': 2, 'selected': False, 'text': "<p>It sounds like the web server on hosttwo.com doesn't allow undefined domains to be passed through.  You also said you wanted to do a redirect, this isn't actually a method for redirecting.  If you bought this domain through GoDaddy you may just want to use their redirection service.</p>\n"}, {'answer_id': 16310, 'author': 'Chris Conway', 'author_id': 1412, 'author_profile': 'https://Stackoverflow.com/users/1412', 'pm_score': 0, 'selected': False, 'text': '<p>It\'s probably best/easiest to set up a <a href="http://www.webconfs.com/how-to-redirect-a-webpage.php" rel="nofollow noreferrer">301 redirect</a>. No DNS hacking required.</p>\n'}, {'answer_id': 16311, 'author': 'Eric Z Beard', 'author_id': 1219, 'author_profile': 'https://Stackoverflow.com/users/1219', 'pm_score': 5, 'selected': True, 'text': '<p>Try changing it to "subdomain -> subdomain.hosttwo.com"</p>\n\n<p>The <code>CNAME</code> is an alias for a certain domain, so when you go to the control panel for hostone.com, you shouldn\'t have to enter the whole name into the <code>CNAME</code> alias.</p>\n\n<p>As far as the error you are getting, can you log onto subdomain.hostwo.com and check the logs?</p>\n'}, {'answer_id': 16323, 'author': 'Michał Piaskowski', 'author_id': 1534, 'author_profile': 'https://Stackoverflow.com/users/1534', 'pm_score': 1, 'selected': False, 'text': "<p>You can only make DNS name pont to a different IP address, so if You you are using virtual hosts redirecting with DNS won't work.</p>\n\n<p>When you enter subdomain.hostone.com in your browser it will use DNS to get it's IP address (if it's a CNAME it will continue trying until it gets IP from A record) then it will connect to that IP and send a http request with </p>\n\n<pre>Host: subdomain.hostone.com </pre>\n\n<p>somewhere in the http headers.</p>\n"}, {'answer_id': 16324, 'author': 'xanadont', 'author_id': 1886, 'author_profile': 'https://Stackoverflow.com/users/1886', 'pm_score': 0, 'selected': False, 'text': '<p>You can do this a number of non-DNS ways.  The landing page at subdomain.hostone.com can have an <a href="http://www.activejump.com/o-6.shtml" rel="nofollow noreferrer">HTTP redirect</a>.  The webserver at hostone.com can be configured to redirect (easy in Apache, not sure about IIS), etc. </p>\n'}, {'answer_id': 16630, 'author': 'Brian G Swanson', 'author_id': 1795, 'author_profile': 'https://Stackoverflow.com/users/1795', 'pm_score': 4, 'selected': False, 'text': '<p>I think several of the answers hit around the possible solution to your problem.</p>\n\n<p>I agree the easiest (and best solution for SEO purposes) is the 301 redirect.  In IIS this is fairly trivial, you\'d create a site for subdomain.hostone.com, after creating the site, right-click on the site and go into properties.  Click on the "Home Directory" tab of the site properties window that opens. Select the radio button "A redirection to a URL", enter the url for the new site (<a href="http://subdomain.hosttwo.com" rel="noreferrer">http://subdomain.hosttwo.com</a>), and check the checkboxes for "The exact URL entered above", "A permanent redirection for this resource" (this second checkbox causes a 301 redirect, instead of a 302 redirect).  Click OK, and you\'re done.</p>\n\n<p>Or you could create a page on the site of <a href="http://subdomain.hostone.com" rel="noreferrer">http://subdomain.hostone.com</a>, using one of the following methods (depending on what the hosting platform supports)</p>\n\n<p>PHP Redirect:</p>\n\n<pre><code>\n&lt;?\nHeader( "HTTP/1.1 301 Moved Permanently" ); \nHeader( "Location: http://subdomain.hosttwo.com" ); \n?&gt;\n</code></pre>\n\n<p>ASP Redirect:</p>\n\n<pre><code>\n&lt;%@ Language=VBScript %&gt;\n&lt;%\nResponse.Status="301 Moved Permanently"\nResponse.AddHeader "Location","http://subdomain.hosttwo.com"\n%&gt;\n</code></pre>\n\n<p>ASP .NET Redirect:</p>\n\n<pre><code>\n&lt;script runat="server"&gt;\nprivate void Page_Load(object sender, System.EventArgs e)\n{\nResponse.Status = "301 Moved Permanently";\nResponse.AddHeader("Location","http://subdomain.hosttwo.com");\n}\n&lt;/script&gt;\n</code></pre>\n\n<p>Now assuming your CNAME record is correctly created, then the only problem you are experiencing is that the site created for <a href="http://subdomain.hosttwo.com" rel="noreferrer">http://subdomain.hosttwo.com</a> is using a shared IP, and host headers to determine which site should be displayed.  To resolve this issue under IIS, in IIS Manager on the web server, you\'d right-click on the site for subdomain.hosttwo.com, and click "Properties".  On the displayed "Web Site" tab, you should see an "Advanced" button next to the IP address that you\'ll need to click.  On the "Advanced Web Site Identification" window that appears, click "Add".  Select the same IP address that is already being used by subdomain.hosttwo.com, enter 80 as the TCP port, and then enter subdomain.hosttwo.com as the Host Header value.  Click OK until you are back to the main IIS Manager window, and you should be good to go.  Open a browser, and browse to <a href="http://subdomain.hostone.com" rel="noreferrer">http://subdomain.hostone.com</a>, and you\'ll see the site at <a href="http://subdomain.hosttwo.com" rel="noreferrer">http://subdomain.hosttwo.com</a> appear, even though your URL shows <a href="http://subdomain.hostone.com" rel="noreferrer">http://subdomain.hostone.com</a></p>\n\n<p>Hope that helps...</p>\n'}, {'answer_id': 4313555, 'author': 'Katie', 'author_id': 525122, 'author_profile': 'https://Stackoverflow.com/users/525122', 'pm_score': 2, 'selected': False, 'text': "<p>These days, many site owners are using CDN services which pulls data from CDN server. If that's your case then you are left with two options:</p>\n\n<ol>\n<li><p>Create a subdomain and edit DNS by Adding a CNAME record</p></li>\n<li><p>Don't create a subdomain but only create a CNAME record pointing back to your temporary DNS URL.</p></li>\n</ol>\n\n<p>This solution only implies to pulling code from CDN which will show that it's fetching data from cdn.sitename.com but practically its pulling from your CDN host.</p>\n"}]
['https://Stackoverflow.com/questions/16298', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/117/']