Copied to clipboard

Flag this post as spam?

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


  • Support 1 post 71 karma points
    1 week ago
    Support
    0

    URL Rewirte Kills image cropper?

    The version is 11.4.2 I set up a URL rewire for the site to remove the trailing slash. It works, however, the image generator stopped working on the front end. Urls like image.png?width=300 shows the original image.

    Not sure what took place here.

    Code in the startup.cs

    app.UseHttpsRedirection();
    
    var rewriteOptions = new RewriteOptions().AddIISUrlRewrite(env.ContentRootFileProvider, "IISUrlRewrite.xml");
    
    app.UseRewriter(rewriteOptions);
    
    // This line is needed for the rewrites to take effect.
    app.UseStaticFiles();
    
    
    
    app.UseUmbraco()
        .WithMiddleware(u =>
        {
            u.UseBackOffice();
            u.UseWebsite();
        })
        .WithEndpoints(u =>
        {
            u.UseInstallerEndpoints();
            u.UseBackOfficeEndpoints();
            u.UseWebsiteEndpoints();
        });
    

    Content in IISUrlRewrite.xml

    <?xml version="1.0" encoding="utf-8" ?>
    <rewrite>
      <rules>
        <rule name="RemoveTrailingSlashRule1" enabled="true" stopProcessing="true">
          <match url="(.*)/$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/App_Plugins/" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/umbraco" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/media" negate="true" />
    
          </conditions>
          <action type="Redirect" url="{R:1}" />
        </rule>
      </rules>
    </rewrite>
    

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft