Skip to content

Redirects

Refer this page to configure redirections for your domain requests.
Typical use-case is, you would want to set country based redirections.

Note: For demo purpose, we will be using www.nviztest.com domain as an example.
Here, we will be redirecting all requests from US to /us/*

Prerequisite

  1. You must have a domain configured on Nitrogen.
  2. You must have a country-based condition configured. Refer guide for it.

Steps

  1. Click on Domains menu, then select Redirects tab. Select appropriate domain from the domains dropdown. Step

  2. Click on Add New button at top right corner.

  3. You will be taken to a screen to provide redirection details.
    Provide the required details:

    1. Comment: Provide short detail about the redirection.
      Note: Please keep the comment meaningful and relevant.

    2. Condition Type: We can configure redirection based on multiple conditions.
      e.g. URL-pattern, request-header, request-user's origin-country, device-type
      Select COUNTRY from the dropdown for now.

    3. Check: Select either matches or not matches as per your requirement.
      We will select matches here.

    4. Condition value to match: Select the required condition you had created in Country condition.
      Select US for this example's need.

      So now the condition for this redirection is Redirect when COUNTRY-matches-US.
      Note: You can add multiple conditions as per your need, by clicking +And button.

    5. Status Code: Select the status code for this redirection.
      e.g. 301 (Permanent redirection), 302 (Temporary redirection) etc.

    6. Source URL: It specifies the regex pattern for the request URL. It supports regex-groups as well.
      Enter ^/(.*) for now.

    7. Destination Domain: It specifies the domain to which the request is to be redirected.
      By default the current domain is populated. You can change it as per your need
      Leave it as is as per this example.

    8. Destination URL: It specifies the regex pattern for the final request URL that will be redirected to. We can use the regex groups matched in source pattern here.
      We will be putting /us/$1 here. So that anything coming in the first regex-group in source pattern, will be prefixed with n7
      e.g.
      Simple homepage request from US will be redirected to /us/
      And, homepage request with any querystring like /?search_term=new will get redirected to /us/?search_term=new
      Similarly, any other request like /new-arrivals will get redirected to /us/new-arrivals

      Step

    9. Note: You can also set multiple redirections those match given condition, by clicking +And button.
      e.g.
      Redirect some URLs to their global pages.
      /return-policy(\?.*)* > /global-return-policy$1
      /store-locations(\?.*)* > /global-store-locations$1
      Redirect everything else to their regional pages.
      ^/(.*) > /us/$1
      Note: the first matched source pattern will be applied for redirections. Therefore, the ordering of the rules is of utmost importance.*

    10. Click on Save button. The configured rule will be showed in Redirects list.

Notes

  1. You can add a certain number of redirections depending upon your plan. For adding more, you can use Shift - Bulk redirections facility. Though, you cannot see/manage them from UI.

  2. Though, the redirections set using Shift have less priority than these redirections. So please manage them accordingly.

  3. The order of patterns is of utmost importance. The first matched rule gets applied. So, please manage it accordingly.

  4. Please purge the source-URL if it's cached. Else, response will be served from cache instead of getting redirected.

  5. Any rule when added, gets placed at the bottom. Use reorder to place it as per need.

  6. These changes will only take effect when deployed. Saving them will only be saving them in draft. Please refer documentation about Deploy process for it.

  7. Use Nitrogen debug header to identify which rule is getting applied to resource.

  8. Only 3 conditions allowed for the redirection rules.