Sitecore XM Cloud - Redirect Items Not Published to Edge: How to Solve It

Thai TranThai Tran
2 min read

In Sitecore XM Cloud, redirection is an out-of-the-box feature that allows editors to set up and publish redirects directly from the Content Editor. This empowers non-technical users to manage redirects efficiently without needing a developer’s support.

With Sitecore XM Cloud, you can add one or multiple redirect items to a site and publish them to Sitecore Experience Edge. These redirect items can then be queried using GraphQL. If you're using the Next.js Sitecore JSS boilerplate, redirect handling is simplified: it automatically works with the redirection middleware in place, requiring no additional configuration.

Querying Redirect Items with GraphQL

Here’s an example GraphQL query to retrieve redirect items from Experience Edge:

query {
 site {
  siteInfo(site: "your-site") {
   name
   rootPath
   redirects {
    isQueryStringPreserved
    redirectType
    target
    pattern
   }
  }
 }
}

Response Example:

{
  "data": {
    "site": {
      "siteInfo": {
        "name": "your-site",
        "rootPath": "/sitecore/content/site-collection/your-site",
        "redirects": [
          {
            "isQueryStringPreserved": false,
            "redirectType": "REDIRECT_302",
            "target": "/new-url",
            "pattern": "/old-url"
          }
        ]
      }
    }
  }
}

In the response, you’ll receive an array of redirects, including both individual redirect items and redirect maps set up for the site.

Troubleshooting: Redirect Items Not Published to Edge

If you’re unable to find your redirect items when querying Experience Edge, try these steps to ensure everything is configured correctly:

  1. Check the Redirection URL: Ensure that the Redirection URL field in the redirect item is populated. If this field is left empty, the item will not be published to Experience Edge.

  2. Republish the Site: After creating or updating a redirect item, republish the site and its subitems to Experience Edge. To do this, select the site item in your content tree, choose “Republish Item and its Subitems,” and check the results in your GraphQL IDE.

These steps should help ensure that your redirect items are published to Experience Edge and work seamlessly within your Sitecore XM Cloud setup. By leveraging these checks and GraphQL queries, editors can easily manage and verify redirects, enhancing the user experience without relying on custom code or developer intervention.

0
Subscribe to my newsletter

Read articles from Thai Tran directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Thai Tran
Thai Tran