Skip to content

Instantly share code, notes, and snippets.

@solrevdev
Created April 19, 2017 07:32
Show Gist options
  • Save solrevdev/f62546d717af0a38a05d28fd26147712 to your computer and use it in GitHub Desktop.
Save solrevdev/f62546d717af0a38a05d28fd26147712 to your computer and use it in GitHub Desktop.
Add a www to requests to the apex domain in web.config transforms
<system.webServer>
<rewrite xdt:Transform="Insert">
<rules>
<rule name="Add WWW prefix to requests to apex domain" >
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^thedomain\.com" />
</conditions>
<action type="Redirect" url="https://www.thedomain.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment