Solving Sitecore SXA Site Manager Conflicts: Mastering Sitecore Multi-Site Management

Solving Sitecore SXA Site Manager Conflicts: Mastering Sitecore Multi-Site Management

👋Introduction

In the recent past, I was working with my colleagues, and we had the following Sitecore setup with Sitecore modules:

Sitecore VersionSitecore 9.x
Sitecore ModulesSitecore PowerShell Extension, Sitecore Experience Accelerator (SXA)

This Sitecore instance was using the Sitecore Experience Accelerator to utilize the Single Sitecore instance to run the multiple Sitecore SXA based websites. The Sitecore SXA Multi site hierarchy for PROD instance looks like: 🔝

💡 What is Sitecore SXA?
Sitecore Experience Accelerator (SXA): Will provide the facility to use out-of-the-box component library, drag n drop facility of component with properties, based on HELIX architecture, easy to work with UI team (Creative Exchange functionality), provide grid’s Bootstrap/Foundation/Grid 960(render columns for RWD), increase productivity, SXA implies best practices and many more.. 🔝 You can check more details here

We decided to do some Sitecore SXA Platform modernization on the platform, thinking of restoring the higher environment database to local so that all required Sitecore updates would be present before starting the new Sitecore SXA development or enhancements.

When you are working with the Sitecore SXA multisite setup, it is always good to identify the list of SXA OOTB/custom components that can be utilised to build or enhance the Sitecore SXA multisite setup. You can check out more details about how to analyse the capabilities of the Sitecore SXA platform here. 🔝

❓Problem Statement

As explained above, we thought of restoring the higher environment database into lower environments for this Sitecore Experience Accelerator multisite setup and started facing an issue. While browsing some sites using the hostname (mentioned in the Sitecore SXA Site Definition item), the request was redirecting to a document not found page (Sitecore SXA multisite 404 error) for the scheduler website: 🔝

Request is redirected to document not found page. Requested url: /en, User: sitecore\Anonymous, Website: scheduler

It means we were getting the wrong site url from the Sitecore SXA Multisite Site Definition Configuration site because the user was redirecting to the wrong site, and the Sitecore SXA website redirects to the Sitecore not found page.

In this blog post, we will learn how to troubleshoot issues related to Sitecore SXA Multisite Setup or Sitecore SXA Site Manager and resolve Sitecore SXA website redirects to Sitecore not found page errors in Sitecore SXA Multisite Setup (where Sitecore SXA Sites are managed using the Sitecore SXA Manager). 🔝

💡 The Sitecore Experience Platform provides facility to configure multiple website on single Sitecore instance, and most of us using Sitecore for multitenant and multisite. You can learn more about multisite setup using Sitecore SXA here.

🕵️The Investigation

To identify the root cause of the error scheduler website not found, we checked the following items in our Sitecore setup:

Sitecore CMS configuration

We used the URL https://[Sitecore CMS Host Name]/sitecore/admin/showconfig.aspx to download and compare the higher and lower environment configurations. This compression can help you identify if any site setup-related configuration is specifically overwritten here, and because of that, your custom SXA site redirects to the Sitecore system website scheduler. 🔝

Sitecore CD configuration

We created the Sitecore Support Package, downloaded the Sitecore Content Delivery configuration, and compared the higher and lower environment configurations. This will help identify any configuration mismatches between environments. 🔝

You can learn more about how to collect basic information about your Sitecore installation here.

Sitecore CD Logs

We checked the Sitecore Content Delivery (CD) logs and found that while accessing the Sitecore SXA website mediadev.contoso.com, SXA Site Manager was trying to find a page in the scheduler website instead of the actual website configured at media site definition (for which hostname value set as media.contoso.com|cm.contoso.com). Due to this, it redirects to a not-found page. 🔝

Sitecore SXA Site Definitions

We compared the Sitecore Site Definition Configuration details with those of other environments.

The existing Sitecore SXA Multisite setup details for PROD website explained here and find below DEV website details 🔝

We compared the Sitecore SXA Site Definition Configuration details and Sitecore SXA site position in Sitecore SXA Site Manager with other environments Sitecore Sites; the only difference is the URLs, but whenever we tried to access the DEVmedia Sitecore SXA Site (for which hostname value set as media.contoso.com|cm.contoso.com) using the host name mediadev.contoso.com, the user was redirected to the Sitecore Not Found page for the scheduler website. 🔝

Tried many combinations of Sitecore Site Definition Configuration

In the DEV Sitecore SXA Site Definition Configuration, we tried the following options:

  1. We created the new Sitecore SXA Site Definition Item and added the same target and hostname values as the existing one, but still the DEV media Site redirects to the scheduler website and shows a document not found page error

  2. Imported the same Sitecore SXA Site Definition Item from PROD after deleting the existing one, but still got the same error

  3. We deleted the other media Site Definition item, which pointed to the host name cmdev.contoso.combak, but still got the same error 🔝

  4. We changed the hostname to *, and with this change, all websites (except corporate) started pointing to the DEV media site configuration (for which hostname value set as media.contoso.com|cm.contoso.com), so this was not the correct option

Tried many combinations of Sitecore SXA Site Manager

We tried the following different options for Sitecore SXA Site Manager:

  1. Moved the DEV media site (for which hostname value set as media.contoso.com|cm.contoso.com) to the top🔝

  2. Moved the DEV media site (for which hostname value set as media.contoso.com|cm.contoso.com) to the bottom

  3. We experimented with several setups without success. 😞

It appears that instead of using the DEV media site configured hostname url media.contoso.com, Sitecore SXA is attempting to locate a page on the scheduler website. and therefore it goes to the "not found" page. 🔝

⚡The Solution

We tried many options, as mentioned in the previous section, and at the end, we went through the order of the existing SXA site resolving process and found that the DEV Media website was not being resolved and was redirecting to the scheduler website.

In this case, we changed the hostname value of the DEV media website site definition item from mediadev.contoso.com|cmdev.contoso.com to *| mediadev.contoso.com, moved this updated DEV media website site definition to the end, and also removed the other DEV media website site definition item that has hostname as a cmdev.contoso.combak: 🔝

After the above changes, we published the site definition items and accessed the Sitecore SXA website, mediadev.contoso.com, and now SXA Site Manager has resolved the correct website. 🔝

This change is a workaround, and it works because when the mediadev.contoso.com hostname is not resolved by any of the site definition items, then it is caught by the media site definition item because we have also mentioned the hostname as * ( * will catch all hostnames ).

I hope this post will guide you to resolve the error Request is redirected to document not found page. Requested url: /en, User: sitecore\Anonymous, Website: scheduler Happy debugging! 🔝

Please note that the solution provided here is a workaround, and it helped us to proceed further without any issue with other websites (or functionalities), and what worked in this instance might not work in another.

🙏Credit/References

🏓Pingback

sitecore sxa multisitesitecore sxa multisite configurationsitecore sxa accordion
sitecore sxa sitemapsitecore sxa site definitionsitecore sxa versions
sitecore sxa componentssitecore sxa dictionarysitecore sxa favicon
sitecore sxa clisitecore jss sxasitecore jss multisite
sitecore-jsssitecore multisitesitecore sxa navigation
sitecore sxa robots contentsitecore sxa tenantsitecore sxa themes
sitecore sxa corssitecore sxa redirect issuesitecore sxa redirects
sitecore sxa redirect mapsxa redirectssitecore sxa redirect not working 🔝
sitecore redirect managersitecore sxa redirect map not workingsitecore redirect to external url
sitecore sxa search results signaturesitecore sxa not resolvesitecore sxa dictionary
sitecore sxa headlessjss sitecore githubsitecore known issues
sitecore sxa versionssitecore sxa robots.txtsitecore xa 🔝