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?
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityYou can follow the below steps to test this scenario :-
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.
LinkItemNotFoundUrl
setting will call and will open /sitecore/service/notfound.aspx
page.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-
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.
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.