Azure front door redirect WWW to non WWW

dg 5 Reputation points
2023-03-13T17:57:53.54+00:00

We have a live website that supports both www and non www. It redirects http -> https using front door, along with some other content related redirects. our analytics partner is asking for only Non WWW traffic for SEO, so we would like to redirect all WWW -> no www traffic.

I have attempted this with a web.config file but it did not work correctly, I'm wondering if we can accomplish this using a front door profile, or if there is another web.config approach to try.

Here is the web.config we attempted earlier.

<rule name="Remove WWW prefix" stopProcessing="true">
    <match url="(.*)" ignoreCase="true" />
    <conditions>
       <add input="{HTTP_HOST}" pattern="^www\.domainname\.net$" />
    </conditions>
    <action type="Redirect" url="https://domainname.net/{R:1}" redirectType="Permanent" />
</rule>
Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
864 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
9,000 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.