There are several ways to setup redirects in Sitecore solution, with Sitecore SXA we have redirect tool in place that facilitates setting up old and new URLs in Sitecore. We can use the mapping tool to set up a 301/302 or server transfer redirect.
Recently we worked on setting up redirects using SXA redirect tool, for most of the redirects we had country code in the old URL.
Here are some example URLs:
Old URL– en-au/sample-old-page-name
New URL– /new-page-name
Old URL– en-au/mypage/pagelisting
New URL– /newpagelisting
What we observed that after setting up old URLs which has country code on it- all such URLs were redirecting to 404 page.
We can fix this by appending “sc_lang” querystring parameter to the new URL with the target country code, see below examples for ref:
Old URL– /sample-old-page-name
New URL– /new-page-name/?sc_lang=en-AU
Old URL– /mypage/pagelisting
New URL– /newpagelisting/?sc_lang=en-AU
After this redirects works as expected.
I hope this helps.