Sitecore 10.2 Sxa, I am trying to add redirection rules with
redirect map, which is under the settings item.
But when I try to add a
redirect map , redirection does not work. What could be the cause of this?
It looks like you are using the third party module from sitecorescientist.com: https://sitecorescientist.com/2018/10/17/redirect-module-for-sitecore-9/
In your screen shot it looks like you have not selected the type of redirect that you want to use. Try changing that to '301 Redirect', republish and test again.
Also, please check that you have completed the setup actions from the github page (for example adding redirectSettingsId to 'website' node in sites config)
If that doesnt work, have you checked that the version of sitecore you are using is compatible with the module? The web page promoting the module suggests its good to use on Sitecore version 9.
If you are using a later version, then you will need to clone a copy of the repository (https://github.com/velan99/SitecoreRedirect) and update the solution to use .Net Framework 4.8 and also the latest sitecore nuget packages.
If you have done all the above, then please double check the sitecore logs to see if there are any clues there.
I just tested the module on using values similar in format to what you have used and it worked as expected.
Please ensure two things when applying a redirect using a redirect map:
'/NewItem Tests And NewsTestRedirect') does not exist in the content tree. The redirect map only functions when an item results in a 404 error.
From the drop-down list, select the type of redirect:
Permanent Redirect (HTTP 301) – redirects target resource to a permanently different URL.
Temporary Redirect (HTTP 302) - redirects target resource to a temporarily different URL.
Server Transfer – helps reduce server requests, keeps the URL the same and is not visible to the client. For example, when you want to transfer the current page request to another .aspx page on the same server or when you want to avoid unnecessary roundtrips to the server.