Copied to clipboard

Flag this post as spam?

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


  • Dmitriy 168 posts 588 karma points
    Feb 13, 2019 @ 09:20
    Dmitriy
    0

    Permanent redirect (301) in a Tamplate logic working too slow on live

    Hello, Umbracians.

    Once apon a time, to make a quick solution of homepage redirect to first child node, I implemented a permanent redirect right within template logic like this:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<RedirectionPage>
    if(Model.RedirectionOverride != null)
    {
        Response.RedirectPermanent(Model.RedirectionOverride.Url); 
    }
    

    RedirectionPage is root node in my case.

    And, for some reason, it works very slow on a live hosting, about 3-7 seconds sometimes.

    I guess, because it needs time to handle default routing before execute the template logic with redirects of it. It is not good anyway, but I didn't expect it take so much time.

    Are there ways to solve the problem with standart Umbraco methods?

    I wanted to use umbracoInternalRedirectId, but it just rewrites the url without 301 redirection.

    What a best practice to give to content manager posibility to manage 301 redirects right into page tabs?

    Thank you

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 13, 2019 @ 09:27
    Alex Skrypnyk
    1

    Hi Dmitriy

    The best way in sense of performance is to use IIS Rewrite Rules. Read more how to use it - https://our.umbraco.com/documentation/reference/routing/IISRewriteRules/

    There are several packages for managing 301 redirects from Umbraco back office, but I don't know which one to recommend. And of course "IIS Rewrite Rules" is more efficient.

    Thanks,

    Alex

  • Dmitriy 168 posts 588 karma points
    Feb 13, 2019 @ 09:51
    Dmitriy
    0

    Hi, Alex

    Is IIS Rewrite Rules the same as umbracoInternalRedirectId? Is it has a defference in performance?

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 13, 2019 @ 09:58
    Alex Skrypnyk
    0

    It should be a huge difference in performance.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 13, 2019 @ 09:57
    Alex Skrypnyk
    100

    no, it's not the same

    "IIS Rewrite Rules" - IIS module, it works with request before umbraco.

    "umbracoInternalRedirectId" - umbraco logic, it works after IIS modules.

    That's why "IIS Rewrite Rules" the best and efficient way.

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft