Create a dynamic URL with a wildcard item

Current version: 9.3

You can use a wildcard item to create dynamic URLs. The item matches any URL on its level in the website structure that is not matched by another item at the same level.

A wildcard item is similar to any other Sitecore item - you can create content for the item, set presentation details for the item, and add the item to a workflow. The only unique aspect of a wildcard item is that its name must be the wildcard character (*).

Note

This feature isn't supported when using Sitecore Experience Edge as the publishing target.

To create a dynamic URL with a wildcard item:

  1. Use the Sample Item template to create an item under the Home item and assign the name "*" to the item.

    Entering an asterix in the Message dialog to name a new item.
  2. Create other items under the wildcard item.

    The content tree structure for a dynamic URL.
  3. Publish the wildcard item and its subitems.

After you publish the items, you can view them on your website using anything in place of "*" in the URL. For example, if your website contains the items in the screenshot above, all of the following URLs lead to the Apples page:

  • https://<your website>/Fruit/Apples

  • https:/<your website>/Snacks/Apples

  • https:/<your website>/<anything>/Apples

The https://my sitecore/Fruit/Apples page.

However if you specify an item that does not exist, the wildcard item is shown. For example, if your website contains the items from the procedure above, and you enter the URL https://<your website>/Fruit/Cookies, the Wildcard page is displayed.

The wildcard page.
Note

A developer can change this default behavior by overwriting the processor Sitecore.Pipelines.HttpRequest.ItemResolver.

Do you have some feedback for us?

If you have suggestions for improving this article,