Search code examples
url-routingazure-web-app-service

Port existing domain traffic to new domain Azure


I am hosting a website I made for a friend on Azure. The website was on "F1 Free" pricing tier, but I just upgraded to the "B1 Basic" pricing tier.

Once I figure out how to setup a custom domain name, is it possible to route all traffic from the old url, to the new url I will be creating?


Solution

  • I'm assuming that by old URL you mean the URL of the web app (something like myrandomsitename.azurewebsites.net) and by new URL you mean the custom domain that you will be adding to your app (something like: myvanitydomain.com)

    if what you want to do is redirect all the traffic from to you can do this with URL Rewrite:

    Your rule would look something like:

    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="SPA">
                        <match url="OLDURL" />
                        <action type="Rewrite" url="NEWURL" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
    

    You can learn more about URL Re-write and Azure Web Apps here: Rewriting a URL in an Azure web app