If you worked with Sitecore SXA you probably already know that its comes with out of the box redirect feature, You can use the mapping tool to set up a 301/302 or server transfer redirect from the original URL to the updated URL, this is useful when you're re-designing your website or if you're creating a new page for an existing URL, this redirect tool provide a way to group redirects in a redirect map, through a Name Value List field, in this post I will show you how you can import you're redirect items into Sitecore in a very easy way.
Before we start I would like to provide a useful link to Sitecore documentation for Mapping URL redirect, click here to get all the useful information, if you have a sitecore sxa website already, if you checked this sitecore path: /sitecore/content/Tenant/Site/Settings/Redirects, you will find the redirects feature, under this item you can start adding your folders and redirect maps, each redirect map you create will have these field:
- RedirectType, where you can chose your redirect type, 301, 302...etc.
- PreserveQueryString: if you want query string to be passed from old URL to the new URL.
- UrlMapping: a name/value list field that map old URL to the new URL
- IncludeVirtualFolder; lets you decide whether to include the virtual folder name at the beginning of your target URL.
Now if you're re-designing your website, you may have a list of redirects that you would like to create, here I'm providing you with a Sitecore PowerShell script that can be used easily to import these from an Excel file you upload to Sitecore media library and imported into a redirect map:
Hope this will help someone out there!! please do reach out through comments or Email if you have any comments. questions or need consultation.
No comments:
Post a Comment