Copied to clipboard

Flag this post as spam?

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


  • Andreas Pfanner 196 posts 314 karma points
    Sep 15, 2014 @ 17:45
    Andreas Pfanner
    0

    Internal Redirect vs Template access

    Hi,

    I want to access a page template directly, since it is a independant static fragment (nothing to do with the site design), so no content associated.

    This generally works by calling http://www.site.com/TemplateAlias which is great.

    Unfortunately on the master page of the site I have defined a internal redirect (umbInternalRedirectId), which seems to prevent the template access and have top priority - so this redirect is ALWAYS done.

    Is there any change to access the template anyway?


    Note: I do the internal redirect on the top level page in order to redirect to the default language homepage, since its a multi language site:

    • Master (umbInternalRedirectId set to de)
      • de (German home page -- shown as default)
      • en (English home page)
  • Andreas Pfanner 196 posts 314 karma points
    Sep 17, 2014 @ 15:06
    Andreas Pfanner
    0

    Nobody? Isn't that possible at all? Isn't it possible to serve a independant template without adding a (dummy) content while having a internal redirect on the top level page active?

  • Zac 223 posts 575 karma points
    Sep 17, 2014 @ 15:42
    Zac
    0

    If it truly has nothing to do with the CMS, perhaps you could add an entry to the "umbracoReservedUrls" setting in the web.config file, such as "~/Views/YourFile.cshtml" and access the page directly.

  • Andreas Pfanner 196 posts 314 karma points
    Sep 18, 2014 @ 14:50
    Andreas Pfanner
    0

    Hi Zac,

    thanks for your suggestion, but unfortunately that didn't work either. I always get 404 while trying to retrieve the template through the correct path.

    Is it a bug that the internal redirect avoids the direct template access or is it the desired behavior?

    Best Regards Andreas

  • Zac 223 posts 575 karma points
    Sep 21, 2014 @ 23:05
    Zac
    0

    That's odd, because I have done this before and I'm not aware of any such bug.

    Do you have the following in your web.config?

    <add key="webpages:Enabled" value="true" />

  • Andreas Pfanner 196 posts 314 karma points
    Oct 06, 2014 @ 17:54
    Andreas Pfanner
    0

    Hi Zac,

    I should mention that I am using a Umbraco 7 instance in a complete MVC/Razor environment. WebPages are disabled by default, so I guess I could get it working changing that. But another way I tried is to remove the internal redirect on the root node and do that redirection to the default language sub node (/de) by a rewrite rule in UrlRewriting.config:

    <add name="defaultpage" virtualUrl="^/$" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/de" ignoreCase="true" />

    Does that make sense? Any downside? Can I extend the rewrite rule that it only is used on a specific host (www.mysite.com), if different sites exist on the Umbraco installation?

    How do others achieve that ("redirect" from the top root node to the default language in a multi lingual site)? Rewriting or internal redirect, or something else?

    Best Regards

  • Amir Khan 1282 posts 2739 karma points
    Oct 06, 2014 @ 19:40
    Amir Khan
    0

    Hi Andreas,

    I've mixed experiences when using an internal redirect on the top node. I always do this in urlrewriting.config like below or using the 301 URL Tracker package: http://our.umbraco.org/projects/developer-tools/301-url-tracker

    -Amir

    <add name="domainRewrite"
    virtualUrl="http://domain.com/"
    rewriteUrlParameter="ExcludeFromClientQueryString"
    destinationUrl="http://domain.com/page"
    redirect="Domain"
    redirectMode="Permanent"
    ignoreCase="true" />
Please Sign in or register to post replies

Write your reply to:

Draft