Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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