Redirect search traffic

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

After configuring the redirect map, to clear the Edge cache and update redirect maps immediately, republish the site item.

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

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,