Copied to clipboard

Flag this post as spam?

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


  • Kyle Carlson 2 posts 72 karma points
    Jan 07, 2016 @ 17:00
    Kyle Carlson
    0

    Strange merging of templates with URL that should 404

    Hey all,

    We're running into strange issues with our URLs.

    We have two templates displayed as so:

    http://www.example.com/about-us

    http://www.example.com/solutions

    Our SEO firm indicated that a page existed (and did not 404) at:

    http://www.example.com/about-us/solutions

    The strange thing is that this page serves most of the content from solutions but includes some text from the About Us page. We've checked the document types for child nodes that might be causing this, but everything seems to be set up correctly. At this point, we aren't sure what is causing this issue.

    Does anyone have any thoughts on resolving this? Please let me know if you need additional information.

    Thank you.

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Jan 08, 2016 @ 23:03
    Marc Goodson
    0

    Hi Kyle

    Umbraco has a hidden feature!

    If you have a url to a page eg

    http://www.example.com/about-us

    it will load with the template it is published under

    you can force it to load with a different template by adding ?altTemplate to the querystring

    eg

    http://www.example.com/about-us/?altTemplate=mobile

    would load the about-us page, not with it's current template but with another template called mobile.

    but that looks a bit messy so they also made it that

    http://www.example.com/about-us/mobile.aspx

    would load the about-us page with the mobile template.

    and even

    http://www.example.com/about-us/mobile

    would do the same.

    So where am I going with this ?

    do you have a template called 'solutions' ?

    if you do then request to

    http://www.example.com/about-us/solutions

    would return a 200, by loading the about-us with the solutions template.

    You can turn this behaviour off in later version of umbraco in config/umbracosettings.config

    in <web.routing

    set disableAlternativeTemplates="true"

    or at least that's what I suspect is happening...

  • Kyle Carlson 2 posts 72 karma points
    Jan 11, 2016 @ 16:43
    Kyle Carlson
    0

    Thanks, Marc.

    That sounds like it might be on the right track. We tried modifying the config but ended up just getting errors. We are on Umbraco version 7.2.2. Should it work for this version?

    And to answer your question, yes we do have a template called "Solutions." However, this seems to be the only template that is resolving to a page. Typing in any other URL combinations with other template names gives a 404. Could there be something specific about that template we are overlooking?

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Jan 14, 2016 @ 01:01
    Marc Goodson
    0

    Hi Kyle

    I think that setting came into play in 7.3.4 (https://github.com/umbraco/Umbraco-CMS/commit/d24ef3650e4bc01c0301e00cbe5210c58732d31b)

    Is the document type that 'about-us' based upon 'allowed' to use the solutions template ? That might be why it works here and not other templates.

    Try renaming the 'Solutions' template, to be 'SolutionsPage' if /about-us/SolutionsPage then returns the 200, mangled page, then at least you know that is what is happening!

    If you can't upgrade and use the config option to turn this behaviour off... and you can't prevent the about-us from using the solutions template - then the other approach would be to remove the IContentFinder for ContentFinderByNiceUrlAndTemplate which is responsible for this behaviour:

    https://github.com/umbraco/Umbraco-CMS/blob/d50e49ad37fd5ca7bad2fd6e8fc994f3408ae70c/src/Umbraco.Web/Routing/ContentFinderByNiceUrlAndTemplate.cs

    from the list of current ContentFinderResolver's on application starting.

    see: https://our.umbraco.org/documentation/reference/routing/request-pipeline/icontentfinder

    public class MyApplication : ApplicationEventHandler
    {
      protected override void ApplicationStarting(…) 
      {     
        // Remove ContentFinderByNiceUrlAndTemplate        ContentFinderResolver.Current.RemoveType<ContentFinderByNiceUrlAndTemplate>();
      }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft