Copied to clipboard

Flag this post as spam?

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


  • Harry Kakoulidis 17 posts 40 karma points
    Mar 25, 2011 @ 13:59
    Harry Kakoulidis
    0

    For 2 root nodes, how can a 404 be returned for pages that don't exist?

    I have two root nodes, with different hostnames, assume en.web.com is the first and gr.web.com is the second, and each is a different language.

    However I have a page, en.web.com/test.aspx that can only exist in one language, and not in the second. So I have not copied this node to the second root.

    How can I make umbraco return a 404 if gr.web.com/test.aspx is requested? Right now it returns the page of the first root, but this is not what I want.

    I'm using 4.7.0.

  • rorythecheese 110 posts 56 karma points
    Mar 26, 2011 @ 01:08
    rorythecheese
    0

    Hi,

    I believe you can set multi language 404's in /config/umbracoSettings.config under settings/content/errors.

    Either that or you can write your own custom 404 handler like this - http://our.umbraco.org/wiki/how-tos/how-to-implement-your-own-404-handler

  • Harry Kakoulidis 17 posts 40 karma points
    Mar 28, 2011 @ 11:27
    Harry Kakoulidis
    0

    I'm sorry as probably I did not write this clear enough. I don't mean custom 404's. What I mean is:

    1) User requests:en.web.com/test.aspx >>> Umbraco returns the node "test" under the root of en.web.com

    2) User requests:gr.web.com/test.aspx >>> Umbraco returns the node "test" *again* of the root en.web.com because test does not exist under the gr.web.com root node.

    Note that I have "umbracoHideTopLevelNodeFromPath" set to true.

    But this is not what I want, as test.aspx does not and should not exist for the second language. I want instead a 404 not found error to be returned (I don't care in what language - this is completely different).

  • Yannick Smits 321 posts 718 karma points
    Mar 28, 2011 @ 12:30
    Yannick Smits
    0

    You need to set useDomainPrefixes to true in config/umbracoSettings.config

  • Harry Kakoulidis 17 posts 40 karma points
    Mar 31, 2011 @ 18:35
    Harry Kakoulidis
    0

    Indeed this does it. However I notice that when useDomainPrefixes is true, umbraco.library.NiceUrl seems to have a different behavior: It returns the hostname with the path (it starts with http://..../test.aspx ). If useDomainPrefixes is false, then it returns only an absolute path without the hostname (it starts with /test.aspx )

    Is this normal? Shouldn't niceurl return the same information no matter what this setting is? I'm using 4.7.0.

    http://our.umbraco.org/wiki/reference/umbracolibrary/niceurl

  • Yannick Smits 321 posts 718 karma points
    Apr 01, 2011 @ 12:28
    Yannick Smits
    0

    You're right would be better if NiceUrl would only render absolute Url's if the nodeid is outside of the current host-name. But that might be a little complex.

Please Sign in or register to post replies

Write your reply to:

Draft