We've got a Sitecore 9 Azure app service instance We've got redirects set up as follows:

<rule name="Root Hit Force HTTPS Redirection" enabled="true" stopProcessing="true">
      <match url="^$" ignoreCase="false" />
        <add input="{HTTPS}" pattern="^OFF$" />
        <add input="{HTTP_METHOD}" pattern="GET" />
      <action type="Redirect" url="https://{HTTP_HOST}/" redirectType="Permanent" />

This seems to be working as expected

Next, what i want

Can anyone please help me with this ?

  • So you want to redirect to https and strip www but only for root url (/)?
    – Marek Musielak
    Nov 5, 2019 at 21:12
  • Hi Marek , thanks for your reply , apologies for not making it clear , not only root url(/), any url request , if it contains www, I want to strip www and redirect to https Nov 5, 2019 at 21:45

1 Answer 1


Below is a rule to remove www from a URL, copied from this blog post. It meets the requirements you've specified:

  • It will handle both http and https (you have https redirect already in place);
  • It applies not only for the root URL(/);
  • It will also work with any hostanme, a hostname is not hardcoded;

Remove www:

<rule name="Remove WWW" patternSyntax="Wildcard" stopProcessing="true">
  <match url="*" />
    <add input="{CACHE_URL}" pattern="*://www.*" />
  <action type="Redirect" url="{C:1}://{C:2}" redirectType="Permanent" />

This rule handles only the removal of www, so it comes as an addition to the https rule you have, not as a replacement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.