Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (45.3k points)

I want to direct some of my other domains to my primary domain which is hosted at a Windows Azure website.

(For the sake of those that find working with CNAME's and DNS a little "foggy" (like I did) I'm going to layout the details.)

I have the domain www.myDomain.com correctly resolving.

I now want to point www.myOtherDomain.com to www.myDomain.com

At my registrar, I have created a CNAME to point
www.myOtherDomain.com to myInternalAzureSite.azurewebsite.net 
and then successfully configured it in the Azure Website domain manager tool.

Now, when I enter www.myOtherDomain.com into a browser, I get the proper web page at www.myDomain.com, however, the address in the browser is still www.myOtherDomain.com not www.myDomain.com as desired.

I understand the two most desirable ways to accomplish this are either:

  1. Forward myOtherDomain.com (which costs $ at some registrars)
  2. Do a 301 permanent redirect

If I have all that correct, I have found many suggestions of HOW to do the 301 redirects, however, I can't seem to figure out WHERE to actually put the redirect?

1 Answer

0 votes
by (16.8k points)

You can also do the redirect by placing this code in your web.config file under the configurationnode:

<configuration>

  <location path="oldpage1.php">

    <system.webServer>

      <httpRedirect enabled="true" destination="http://domain.com/newpage1" httpResponseStatus="Permanent" />

    </system.webServer>

  </location>

  <location path="oldpage2.php">

    <system.webServer>

      <httpRedirect enabled="true" destination="http://domain.com/newpage2" httpResponseStatus="Permanent" />

    </system.webServer>

  </location>

</configuration>

Browse Categories

...