IIS7 URL Rewrite multiple domains to a single domain including google analytics referral code

心不动则不痛 提交于 2019-12-06 11:59:41

This is a guess but what about:

<rule name="Redirect" enabled="false" patternSyntax="Wildcard" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="^www.mydomain.co.uk$" negate="true" />
        </conditions>
        <action type="Redirect" url="http://www.mydomain.co.uk/?utm_campaign={HTTP_HOST}&amp;utm_source={HTTP_HOST}&amp;utm_medium=referral" />
</rule>

Looked this up and it says you can use it this way in this documentation:

Thanks @rtpHarry for the guidance. Although the above rule didn't work for me, I managed to tweak it for my IIS7 server.

<rule name="Redirect" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^www.tsogosundigishare.com$" negate="true" />
    </conditions>
    <action type="Redirect" url="http://www.tsogosundigishare.com/" redirectType="SeeOther" />
</rule>

By removing the enabled="false" and patternSyntax from the rule, it converted the rule from being "Wildcard" to "Regular Expression" and adding redirectType="SeeOther" redirected properly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!