Copied to clipboard

Flag this post as spam?

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


  • Gregory 37 posts 127 karma points
    Nov 15, 2018 @ 15:59
    Gregory
    0

    URLs with file extensions do not redirect to set 404

    Hey again :)

    Umbraco cloud 7.12.4

    Installed the plugin and all is well however there is no redirect in place if someone enters a url which ends with a file extension such:

    http://www.mysite.com/thisfile.pdf

    As we serve a lot of files which are sometimes marketed by email, we might provide URLs to directly download files which could really be mistyped on occasions. Is there anyway to apply the redirect to any non existing URL, irrespective of if it s a pretty URL or one ending with a file extension?

    Thanks,

    Greg

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Nov 15, 2018 @ 16:58
    Tim Geyssens
    0

    think you'll need to look into the web.config and make sure the requests are handled by .net

  • Marcelo 18 posts 131 karma points
    Nov 15, 2018 @ 18:42
    Marcelo
    2

    Hi Gregory,

    I had some issues regarding this and in my case I was trying to force the custom 404 page, the workaround that I found was to set inside the web.config this:

    <system.webServer>
        <httpErrors errorMode="Custom" existingResponse="Auto">
          <remove statusCode="404" subStatusCode="-1" />
          <error statusCode="404" prefixLanguageFilePath="" path="/arbitraryPathThatDoesNotExistAndThatWillRespondWithA404" responseMode="ExecuteURL" />
        </httpErrors>
    </system.webServer>
    

    Basically, the request will be handled by the server as 404 error it will try to open the page error "/arbitraryPathThatDoesNotExistAndThatWillRespondWithA404" so the .Net will handle as 404 error to Umbraco.

  • Gregory 37 posts 127 karma points
    Nov 16, 2018 @ 11:43
    Gregory
    0

    Top stuff man! that sorted it! Thanks a lot for that! :)

  • 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