Copied to clipboard

Flag this post as spam?

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


  • David Zweben 268 posts 753 karma points
    Mar 27, 2013 @ 15:32
    David Zweben
    0

    'Alternate template in URL' feature causing problems. Can I disable it?

    I'm building a new site on Umbraco 6.0.2. Its content tree looks like this at the moment:

    It uses these templates:

    I typed in "website.com/contact", forgetting that the URL should actually be "website.com/company/contact" and was puzzled to see the homepage content presented in my Contact template. Once I figured out that I had typed in the wrong URL, I realized that this was the 'alternate template' functionality at work, and because some of my template names are the same as my page names, it was causing confusing behavior.

    I decided it was probably a bad idea to name the templates like I did, and renamed them to ContactPage, DownloadsPage and NewsPage, but I'm still concerned that this alternate template functionality could cause similar confusion down the road. Is any way I can disable the 'specify an alternate template in the URL' functionality, at least in the format of "website.com/pagepath/templatename"? I wouldn't mind keeping "website.com/pagepath?alttemplate=templatename" active, because that's much less confusing, but if it's all or nothing, I'll just turn them both off.

    Any help would be appreciated,
    David

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 27, 2013 @ 18:33
    Jan Skovgaard
    0

    Hi David

    I'm not sure how it can be disabled. But I'm not really sure it's going to be a real issue for you?

    It's not like the alternate pages are being indexed in search engines and unless you use them in your navigation for the site for some reason website visitors will probably never even hit those pages. Especially not now that you have named your templates with the appending "Page" convention.

    So I guess I'm saying I don't think this will be a problem for you when people browse the site hence I don't think it's worth spending time on fixing imho :)

    However I'm curious if someone knows how to turn it off though - always fun to learn something new.

    Cheers,
    Jan 

  • Michael 6 posts 28 karma points
    Apr 26, 2013 @ 15:22
    Michael
    2

    Hi guys,

    We've also met the issue that you can't disable the alternative template URL parameter. 

    However, you should be able to disable the URL resolution for it, by removing

    <notFound assembly="umbraco" type="SearchForTemplate"/>

    from /config/404handlers.config.

    I don't know specifically which versions of Umbraco this works in, but I think it's probably worth a try.

    Hope this helps.

  • Funka! 398 posts 661 karma points
    Apr 30, 2013 @ 19:16
    Funka!
    0

    I prefix all of my template aliases with "tpl" (e.g., "tplContactPage") so that these are quite unlikely to ever be typed in by accident or even legitimately by an umbraco admin or editor. For the same reason you noted, even though I realize I'm just repeating what you already found as your solution.

  • RuneO 36 posts 116 karma points
    Oct 05, 2017 @ 10:41
    RuneO
    0

    I know this topic is old, but just stumbled upon it and wants to share my experiences on the matter.

    When working with permissions it's very important to disable "SearchForTemplate" as Michael mentions above. Because hitting a page by it's template name is NOT protected by any permissions. Of course when hitting a page by it's template name, you're out of the Content tree context, and most pages will therefore fail. But sometimes you do e.g. a utility page for your project (which is not dependent on any content) and restrict it's public access. But you can access the page anyway by using it's template name in the url (and because it being out of the content tree context, there's no restrictions at all). It requires that someone guesses the template name of course, but I don't like knowing that restricted pages are publicly avaiable in any form.

    I've always been puzzled why this has been default behavior in Umbraco since the dawn of day. The use case for this behavior cannot be common at all.

Please Sign in or register to post replies

Write your reply to:

Draft