Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making domain-level redirects happen after specific page redirects #57

Open
agileadam opened this issue Sep 29, 2020 · 1 comment
Open

Comments

@agileadam
Copy link

Hello, I'm looking to use this module to replace some Web.config rewrite rules.

Our site admins would like to create redirects in the admin without having to have us make code changes.
It seems we can't mix Web.config rewrites with sitecore-based redirects because it's unpredictable.
The Web.config rewrites happen first and sometimes make the sitecore-based rewrite rules not match.

We have many domains pointing to our one Sitecore instance.
Example: "bar.org" (primary site) and "foo.org" (additional domain)

We have two types of rules (using rewrite maps because there are tons of these), shown below.

I know I can handle both of these redirect types with this module, but is there anything I can do to make sure the domain level redirects happen last (after the page-level redirects have had a chance to match)?

Page Level:

    <rule name="Foo rule" stopProcessing="true">
        <match url=".*"/>
        <conditions>
            <add input="{HTTP_HOST}" pattern="^(www.)?foo.org$"/>
            <add input="{FOO:{URL}}" pattern="(.+)"/>
        </conditions>
        <action type="Redirect" url="{C:1}" appendQueryString="true" redirectType="Permanent"/>
    </rule>
    ...
    <rewriteMap name="FOO">
        <!-- foo.org -->
        <add key="/my/page/here" value="https://www.bar.org/some/other/specific/path"/>
        ... more here ...
    </rewriteMap>

Domain Level:

    <rule name="Domain-level rule" stopProcessing="true">
        <match url=".*"/>
        <conditions trackAllCaptures="true">
            <add input="{Domains:{HTTP_HOST}}" pattern="(.+)"/>
            <add input="{REQUEST_URI}" pattern="(.+)"/>
        </conditions>
        <action type="Redirect" url="{C:1}{C:2}" appendQueryString="false" redirectType="Permanent"/>
    </rule>
    ...
    <rewriteMap name="Domains">
        <add key="foo.org" value="https://www.bar.org/foo"/>
        ... more here ...
    </rewriteMap>
@agileadam
Copy link
Author

Bump. Anyone have any input on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant