woodykiddy
woodykiddy

Reputation: 6455

How to redirect requests to a different web app hosted via Azure App Service

I have two web apps hosted via Azure Web Services, with the URL https://example1.azurewebsites.net and https://example2.azurewebsites.net respectively.

What I am looking at is that I'd like to redirect requests for example1 to example2 without any code changes or redeployment. I am not too sure if Azure Web Service supports this kind of configurations out of the box. If so what'd be the best option for this?

Update: To clarify, the URL needs to change to example2 from example1 for all the requests.

Upvotes: 6

Views: 11298

Answers (1)

Rob Reagan
Rob Reagan

Reputation: 7686

The easiest way to do this is to update your web.config with a redirect rule. You can even edit the web.config in the WebApp's SCM site without even having to FTP in or redeploy. Here's the Microsoft docs.

This code should do it, but I haven't tested it.

<system.webServer>
   <httpRedirect enabled="true" destination="http://www.contoso.com/" />
</system.webServer>

Upvotes: 6

Related Questions