Create a redirect map

Current version: 10.2
Note

Use the Content Editor for the steps described in this topic.

When you redesign your website or create a new version of an existing web page, it is important to redirect the search traffic from the old pages to the new pages. You can use the mapping tool to set up a 301/302 or server transfer redirect from the original URL to the updated URL.

Important

If you add redirect mapping, redirection starts only if Sitecore cannot find a matching item, just before the user is redirected to the Page Not Found page (HTTP 404).

To create a redirect map:

  1. Navigate to your site, click Settings, and then right-click Redirects.

  2. To redirect a map item, click Insert > Redirect Map.

    Tip

    For a better overview, you can group your redirect map items by adding them to a Redirect Map Grouping folder.

  3. Enter a name and click OK.

  4. In 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.

  5. To match the redirected URL with the original URL's query string of the request, select the Shall query string be preserved upon redirect? check box.

  6. Use the mapping section to map between the old (left) and new (right) URL paths. You can use one of the following options. All options are case-insensitive:

    • Direct match – the path of the incoming request is equal to a pattern. Patterns must start with /.

    • Regular expression – if the pattern starts with ^ (match only if the following is at the beginning of the line) and ends with $ (match only if the previous is at the end of the line) regular expression matching is used. Patterns must include / at the beginning and the end. For example: ^/blogs/blogs-november/$.

      The target can include tokens - $1, $2, and so on - that will be replaced by matching capturing group from the input. For example:

      Source: ^/products/(.*)/(.*)$.

      Note

      The capturing groups must be in parentheses.

      Target: ^/groceries/$1/$2$.

      URL: /products/fruit/apple/.

      Redirect URL: /groceries/fruit/apple/.

    • SXA tokens - you can use SXA Tokens to define basic strings, for example, home.com/404. You can also specify more specific elements like language and virtual folder, for example, home.com/$siteLang/$vf/404.

Examples of mapping

The following examples show how to use expressions in the Redirect Map dialog:

  • Redirect a page with a direct match:

    Note

    The Include virtual folder option lets you decide whether to include the virtual folder name at the beginning of your target URL.

  • Redirect the page with a regular expression:

    In this example, the regular expression ^/ab[cd]/$ matches the following URLs:

    • /abc/

    • /abd/

    • /abc

    • /abd

Do you have some feedback for us?

If you have suggestions for improving this article,