0

I created a custom handler to handle 301 redirect for .html extensions which is working fine. But now my client also wants to serve static html files too.

When I deploy those html files into our website root they are not getting served because of the custom handler as it do not find any 301 redirect for the same.

Is there a way to achieve both the scenarios like if no 301 redirect it should look for html file on that path and if look it should serve?

Thanks in advance :)

1

What happens when you remove your handler from the pipeline? Does it resolve the HTML files properly? If yes, try placing your handler later in the pipeline and then Sitecore might be able to resolve your HTML files from website, before executing your redirect handler.

| improve this answer | |
  • Thanks for replying @jjczopek. I found there is a pipeline patch:before="processor[@type='Sitecore.Pipelines.PreprocessRequest.CheckIgnoreFlag, Sitecore.Kernel'] which make a flag if Sitecore will serve the required extension to true. So I modified this pipeline for .html pages. So here I check if there is a physical file present to serve, I return false and then IIS serve the Static HTML page. If I have a 301 redirect for the required URL then I redirect to desired URL. – Arpit Sep 5 '17 at 11:21

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