0

We have a setting under Sitecore.config file.

<setting name ="LinkItemNotFoundUrl" value ="/sitecore/service/notfound.aspx" />

Could someone assist me real time scenario when this setting will hit the page?

4 Answers 4

3

You can follow the below steps to test this scenario :-

  • Create two Sitecore items in Content Editor, one is Page 01 and second is Page 02. On Page 01 in the Content Editor add content in rich text field and create an anchor tag on Page 2 text for Page 02 item.

enter image description here

  • Now , open this page in Experience Editor. You can see the anchor tag on Page 2.

  • Delete Page 02 in Content Editor and it will open dialog box, select Leave links option.

enter image description here

  • When, you will open Page 01 in Experience editor and click on the link then LinkItemNotFoundUrl setting will call and will open /sitecore/service/notfound.aspx page.
2

As per my understanding here is the use of this field.

linkItemNotFoundUrl: The URL to redirect to if an item being linked to is not found.

Default value: if not specified, the value of the LinkItemNotFoundUrl setting in the <settings> section is used.

Initially, You don't need to extend the processor, there are settings in the Sitecore section of config to handle these. Update these values to point to the correct path. This can be a Sitecore item path, e.g. /errors/404 as long as that item exists in Sitecore.

Alternatively, You may need to create a processor that will handle this request. Use this article for more details on how to create a processor.

http://sitecoreblog.navavayas.com/Blog/35/Better-way-of-handling-sitecore-404-pages-

1
  • is that link not active?
    – Astle
    Jul 18 at 5:53
1

According to Sitecore documentation:

/// <summary>Gets the URL to redirect to, if an item is not found.</summary>
/// <value>Default value: "/sitecore/service/notfound.aspx"</value>
/// <remarks>
/// If a request for a non-existing item comes in on the
/// web site, the request is redirected to the url pointed to
/// by this setting.
/// </remarks>
public static string LinkItemNotFoundUrl => Settings.SettingsInstance.Core().LinkItemNotFoundUrl;

What is interesting though, looks like it's only used in obsolete DynamicLink class methods in Sitecore 10.X, so it looks like it should not be used at all in any new Sitecore implementations.

2
  • Do you have any example to test this as I am working on some scenario?
    – Nisha
    Jun 21, 2022 at 11:13
  • See updated answer.
    – Marek Musielak
    Jun 21, 2022 at 11:14
0

While generating an Item URL for non-existing culture version, It generates the URL of page specified at LinkItemNotFoundUrl configuration setting. The configuration defines the page, which does not respect the language in Multi-culture websites.

As per, example of Build an Item URL; URL generation respects culture/language based on the LinkBuilder/UrlBuilder configuration. https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-manager/build-item-and-media-urls.html

Error URL generation may also, need to respect LanguageEmbedding and Language Location configuration. Sitecore registered a feature request for the product so that it can be considered for future implementation. To track the future status of this request, please use the reference number 541614.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.