Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Asmi-Sharma 2 posts 22 karma points
    May 14, 2024 @ 08:09
    Asmi-Sharma
    0

    Rewrite rules Umbraco 13

    Hi,

    I created a web.config file on root of the project and then wrote the rewrite rules in a local clone. After I push it to live environment it does not reflect the rules written.

    My web.config file is:

    web.config

    web.config

    Problem is: When I search for xyz.nl it should redirect to https://www.xyz.nl, but it does not redirect.

  • Sergey 6 posts 77 karma points
    May 17, 2024 @ 07:27
    Sergey
    0

    Hi!

    Does asp.net core support classic's asp.net configs? I don't think so. You could achieve redirect in .net core app in multiple ways, but if you want something close to classy way, then do following:

    Create IISUrlRewrite.xml in a root of your site. Name can be any, but content will be following:

    <?xml version="1.0" encoding="utf-8" ?>
    <rewrite>
        <rules>
            <!-- Your rules here -->
        </rules>
    </rewrite>
    

    Add rewriter pipeline to Program.cs:

    WebApplication app = builder.Build();
    await app.BootUmbracoAsync();
    
    var rewriteOptions = new RewriteOptions()
        .AddIISUrlRewrite(app.Environment.ContentRootFileProvider, "IISUrlRewrite.xml");
    app.UseRewriter(rewriteOptions);
    app.UseStaticFiles();
    
  • Asmi-Sharma 2 posts 22 karma points
    May 21, 2024 @ 04:17
    Asmi-Sharma
    0

    Hi,

    I have already tried this method following the Umbraco documentation: https://docs.umbraco.com/umbraco-cms/reference/routing/iisrewriterules

    But the problem was not solved.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies