How to redirect siteA to siteB with A or CNAME records


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

I added a CNAME record to host one that points to but all I get is a '400 Bad Request' Error.

Can anyone see what I'm doing wrong?

This question is tagged with dns web-hosting cname

~ Asked on 2008-08-19 14:42:29

7 Answers


Try changing it to "subdomain ->"

The CNAME is an alias for a certain domain, so when you go to the control panel for, you shouldn't have to enter the whole name into the CNAME alias.

As far as the error you are getting, can you log onto and check the logs?

~ Answered on 2008-08-19 14:46:12


I think several of the answers hit around the possible solution to your problem.

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, 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 (, 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.

Or you could create a page on the site of, using one of the following methods (depending on what the hosting platform supports)

PHP Redirect:

Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location:" ); 

ASP Redirect:

<%@ Language=VBScript %>
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",""

ASP .NET Redirect:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";

Now assuming your CNAME record is correctly created, then the only problem you are experiencing is that the site created for 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, 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, enter 80 as the TCP port, and then enter 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, and you'll see the site at appear, even though your URL shows

Hope that helps...

~ Answered on 2008-08-19 17:57:10


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:

  1. Create a subdomain and edit DNS by Adding a CNAME record

  2. Don't create a subdomain but only create a CNAME record pointing back to your temporary DNS URL.

This solution only implies to pulling code from CDN which will show that it's fetching data from but practically its pulling from your CDN host.

~ Answered on 2010-11-30 12:08:39


It sounds like the web server on 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.

~ Answered on 2008-08-19 14:45:07


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.

When you enter 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


somewhere in the http headers.

~ Answered on 2008-08-19 14:50:47


It's probably best/easiest to set up a 301 redirect. No DNS hacking required.

~ Answered on 2008-08-19 14:46:09


You can do this a number of non-DNS ways. The landing page at can have an HTTP redirect. The webserver at can be configured to redirect (easy in Apache, not sure about IIS), etc.

~ Answered on 2008-08-19 14:50:48

Most Viewed Questions: