I have a sublayout/rendering that lives on a wildcard item within the content tree. For example, at /sitecore/content/home/news/news-features/*/*/*/*.

The sublayout/rendering checks an external data source to determine if content should be returned and does so if it can find it. However, if the content is not found for the path I would like to trigger our normal 404, which we've set up via the ItemNotFoundUrl Sitecore config setting.

Right now the control is simply doing a Response.Redirect("/not-found", true); if content for the request cannot be found, but I'm wondering instead if an exception can be thrown, or the item not found pipeline/processor can otherwise be triggered.

Can a sublayout/rendering trigger the item not found pipeline, such as when wildcard paths are used? Or is redirecting the best practice?

1 Answer 1


I would suggest that create your own processor and place it after Sitecore.Pipelines.HttpRequest.ItemResolver, In your processor check if the context item is a wild card and check your external data source, if no data matches your external source, then set the context item to null, This should take care of triggering the "item not found" pipeline

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor type="Namespace.WildcardResolver, AssemblyName"
                   patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']" />

And your code :

public class WildcardResolver : HttpRequestProcessor
    public override void Process(HttpRequestArgs args)
        Assert.ArgumentNotNull(args, "args");
        //Item is not null and is wild card
        if (Sitecore.Context.Item != null || Sitecore.Context.Item.Name == "*")
            //Verify that external data source have the data 
            //If not, then set the context item to null ,
            // Sitecore.Context.Item  = null
  • Brilliant, thank you.
    – pirsqua
    Oct 1, 2021 at 23:41

Your Answer

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

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