Issue with running a Non-SXA site on a SXA installation

I want to capture this here if it helps others. This is a problem my team encountered and we found a workaround.

So here is the issue:
We are moving an non-SXA site from Sitecore 7.2 to Sitecore 9.3. We decided that the first cut of this lift and shift will be non-SXA. So we did a non-SXA installation of Sitecore and did a POC on developers VM (yes VM). It works. Everyone is happy.

We took the code and pushed it through the DevOps pipeline to one of our Azure Dev environment to see how it works there. Nothing Shows up. No One is happy now.

After some digging we found that, the rendering datasource and placeholder in the component level is not being honored. If we take a page and put the placeholder and datasource for the came component. It works. Somewhere in the pipeline, the SXA interferes.

We wend ahead and took the SXA and JSS SXA folders from the app_config/Modules and put it under temp. After this the component datasource started working like it should but on Sitecore CM all the images showing error. So that broke the Images.

To fix that, We took the Web.config in the root and removed the line that was under for sitecore_media.ashx and added the following line

      <!– <add verb=”*” path=”sitecore_media.ashx” type=”Sitecore.XA.Foundation.MediaRequestHandler.MediaRequestHandler, Sitecore.XA.Foundation.MediaRequestHandler” name=”Sitecore.MediaRequestHandler” /> –>

                  <add verb=”*” path=”sitecore_media.ashx” type=”Sitecore.Resources.Media.MediaRequestHandler, Sitecore.Kernel” name=”Sitecore.MediaRequestHandler” />

Now the images came back.

I think you might be able to do the same type of work without moving those SXA folders under app_config/Modules. You have to customize your layers.config and use mode=”off” key. Here is a link

I have created an Sitecore Stack exchange post few days ago for this. Here is the link for that.

Anyway, I might update this if we find anything new.
Hopefully this is useful.