Copied to clipboard

Flag this post as spam?

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


  • Sjaak van der Heide 34 posts 106 karma points
    Mar 03, 2022 @ 12:50
    Sjaak van der Heide
    0

    Redirects in combination with Virtual Nodes

    Hey all

    There is a known issue with 301 redirects and Virtual Nodes.

    As it stands when a page that is under a virtual node is renamed, the automatic redirect wil fail because it will take the url with the virtual node when it redirects. i.e. umbraco.com/main-menu/contentpage (where main-menu is a virtual node) will be accessible when calling umbraco.com/contentpage

    But when redirecting it will still see /main-menu/ as part of the original URL. I've managed too get around this by hooking in on the publishing, published and saving events. And there adding my own redirect using the IRedirectUrlService. Now this work perfectly for the biggest part. Only problem is the urlHash!

    It's the original URL SHA1 hashed.

    The register function takes a url (as string) and the key of the page it belongs too. In my case I would set the url without the virtual node in it.

    But it seems that under water it still manages to take the URL with the virtual node for the SHA1 hash. I compared these in the DB.

    I know it is doable by inserting the redirect directly into the Database myself. But I really don't like doing queries in project code.

    So I guess my question is, is there a way too manipulate the SHA1-hahs in redirects without having to do the db-query manually?

Please Sign in or register to post replies

Write your reply to:

Draft