Skip to content

Instantly share code, notes, and snippets.

@chrismrgn
Created May 25, 2015 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismrgn/53338cd5b48c9803159a to your computer and use it in GitHub Desktop.
Save chrismrgn/53338cd5b48c9803159a to your computer and use it in GitHub Desktop.
Rewrite Config Tridion Razor Mediator Component Template
<?xml version="1.0" encoding="utf-8"?>
<rules>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
@foreach(var cp in Component.rules)
{
<rule name="@cp.redirect_name" stopProcessing="true">
<match url="^/?@(!string.IsNullOrWhiteSpace(cp.watch_url) ? cp.watch_url.TrimStart('/') : string.Empty)/?$" />
@{var permanent = cp.permanent_redirect.Title == "Yes"; }
<action type="Redirect" url="@cp.target_url" redirectType="@(permanent ? "Permanent" : "Found")"/>
</rule>
}
</rules>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment