Redirect search traffic

Version: 10.4
Note

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

To redirect search traffic, you can redirect a specific page to a new location, or create a redirect map.

Redirect a URL

A redirect is a way to send both users and search engines to a different URL from the one they originally requested. For example, to redirect visitors who enter namewebsite.com/page-a in their browser to namewebsite.com/page-b. This is very useful when you want to redirect a specific page to a new location, change the URL structure of a site so that it appears higher up in the navigation, or even redirect users to another website entirely. You can also use the mapping tool to set up a 301/302 or server transfer redirect.

To add a redirect item:

  1. Right-click on the page where you want to specify your redirect, and click Insert, Redirect.

  2. Enter a name for the redirect item and click OK.

  3. In the Redirect section, enter the URL that you want to direct to and save your changes. You must request exact redirect item (in this example: Customer 1) in the content tree to trigger the redirection (Customer 2).

    Request the exact redirect item in the content tree to trigger the redirection.
  4. After adding the new redirect item, to clear the Edge cache and update redirect data immediately, republish the site root item.

Note

To ensure that the redirect works properly, we recommend that you configure the target hostname and scheme on all site definition items.

Create a redirect map

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:

Important

If you use duplicate redirects or regex patterns that could match multiple pages, the order of redirect items can affect which redirect is applied. For more information, see Understanding redirect map order and processing.

  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/.

      Note

      Using regular expressions are costly operations so they shouldn’t be used extensively.

      Note

      If your host is on Netlify, be aware that Netlify automatically sorts query string parameters alphabetically. This behavior should be considered when using regular expressions (regexp) to create redirects.

  7. To clear the Edge cache and update redirect maps immediately, you must republish the site root item.

    In the site tree, click the Site item, then on the Publish tab, in the Publish group, click the Publish drop-down arrow, and select Publish item. Alternatively, right click the Site item and select Publish Item.

  8. In the Publish Item dialog, click Republish. here's no need to republish child items.

  9. Click Publish.

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

Understanding redirect map order and processing

Redirect map folders and items help you organize redirects in the content tree. This structure is for visual organization only. During processing, the system evaluates all redirects together.

Redirect order matters only when more than one redirect could match the same request. This typically happens when duplicate redirects exist or when regular expression (regex) patterns are broad enough to match multiple pages.

Key points

  • Redirect folders and items are organizational only - they exist to structure redirects visually in the content tree.

  • All redirects are merged at runtime - folder structure does not create logical groupings.

  • Redirects are evaluated top to bottom - the system processes redirects in the order they appear.

  • The first matching rule wins - once a match is found, no further redirects are evaluated.

  • Folder order affects evaluation - redirects in higher folders are processed before those in folders below.

  • Ordering matters only for overlapping rules - this includes duplicate redirects or broad regex patterns that can match multiple pages.

Example: overlapping patterns

Consider the following redirects:

  • /products/shoes to /shop/shoes

  • ^/(.*)$ to /home

The second rule is a broad regex pattern that can match many pages, including /products/shoes. If this rule is evaluated first, it matches the request before the more specific redirect is reached.

To ensure the intended redirect is applied, place specific redirects before broader or catch-all patterns.

Do you have some feedback for us?

If you have suggestions for improving this article,