Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rewrite Config Tridion Razor Mediator Component Template
<?xml version="1.0" encoding="utf-8"?>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
@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")"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment