1

Is there any way to implement URL Redirect from one Sitecore page to another page?

Like Home/PageA ===> Home/PageB both pages exist in Sitecore.

I tried with Redirect Map with Permanent Redirect(301) and 302 but it only works if the old URL does not exist in Sitecore.

2

1 Answer 1

1

If you have a page item that is published, that page item will always override any SXA redirect map.

You have 2 options:

  1. Delete the item
  2. Unpublish the item

Generally, my workflow is this:

If I am creating a 301 redirect, this is permanent. I'm just going to delete the item from the content tree and not worry about it. Once the item is deleted, then the redirect map will start working as expected.

If I'm creating a 302 or something else temporary or if I think the content page will be needed, or if because of compliance we need to keep old versions for a period of time, I will just set the page to be unpublished and that will also make sure the redirect map will work.

the tl/dr; is, you need to remove the page from the published site for your redirect to work.

4
  • Thanks Richard. I am trying to find a way to work this without deleting and unpublish. Just like market place redirect module having that type of functionality. Commented Apr 1, 2021 at 11:59
  • The only way to do that is to add your redirect to the web.config. SXA redirects make the page item take priority over the redirect. Why would you not want to unpublish a page that you are redirecting?
    – Richard Seal
    Commented Apr 1, 2021 at 14:20
  • Actually our requirement is that we need to redirect all child pages under visit-information like visit-information/A/B to visit-information/schedule-appointment/services-unavailable .we have created one rule to redirect all child pages . If we unpublish all pages then redirected page also get unpublish as it resides under same node. we need to unpublish required pages one by one and we have total 9 pages. Content author don't want to do. One solution is to move out redirected page from that node and unpublish that node with child pages.any better approach ? without code change. Commented Apr 2, 2021 at 7:23
  • Use a Redirect Map instead of a Redirect item, and tell your content author to stop being lazy :D
    – Richard Seal
    Commented Apr 2, 2021 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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