MrBliz
MrBliz

Reputation: 5908

Enforcing Canonical Host Name - Azure, IIS

I wish all requests to www.liamblizard.co.uk to be redirected to liamblizard.co.uk

This is the rule i've got in web.config to do the rewrite

<rule name="Canonical Hostname" stopProcessing="false">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
      </conditions>
      <action type="Redirect" url="http://{C:2}{REQUEST_URI}" redirectType="Permanent" />
    </rule>

but all requests to www.liamblizard.co.uk fail

enter image description here

Do I need to do anything at the DNS level, ie: CNAME records, or should that IIS rule take care of everything?

The site is an Azure Standard Website if that matters.

Upvotes: 0

Views: 219

Answers (1)

viperguynaz
viperguynaz

Reputation: 12174

At your DNS, update the www CNAME record to point to liamblizard.co.uk

Upvotes: 1

Related Questions