# How to Install Massive Redirect

**Massive Redirect** is a *serverless* integration available at Azion Marketplace. This type of integration is mainly used for handling a massive quantity of domain redirects, such as domain migrations.

This integration permits you to control this domain redirection directly at the network's edge, centralizing the management of several settings in one location. It also enables you to operate a variety of situations, such as CMS or e-commerce platform migration, website upgrades, and many others. No matter how many pages you have, you can configure all your redirects with the Massive Redirect integration.

:::note
You have to observe the limit of 300 kb for the JSON file.
:::

---

## Getting the integration

To use the **Massive Redirect** integration provided by Azion Marketplace, you have to:

1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Marketplace**.
2. On the Marketplace homepage, select the integration's card.
3. Once the integration's page opens, click the **Install** button, at the bottom-right corner of the page.

You'll see a message indicating that your integration was successfully installed.

:::tip
You can search any integration by browsing through the cards, using the filters, or typing a keyword in the search bar.
:::

---

## Configuring the integration

Once you've gotten your integration on **Marketplace**, it'll be available at your functions list. To use the integration, you'll have to create a new applications.

:::tip
To create an applications, go to the [building](/en/documentation/products/guides/build/build-an-application/) section.
:::

### Configuring Firewall

To configure your integration, proceed as follows:

1. On the upper-left corner, select **Products menu** > **Applications** on the **BUILD** section.
2. On the listing page of your applications, select the one you want to use with the integration.
3. On the application page, on the **Main Settings** tab, locate the **Functions** switch and turn it on.
4. Click the **Save** button.

You'll receive a success message indicating that your applications has been updated.

:::caution[Warning]
If a product or module is activated, it could generate usage-related costs. Check the [pricing page](/en/documentation/products/pricing/) for more information.
:::

### Instantiating the integration

To enable this function:

1. Select the **Functions Instances** tab.
2. Click the **+ Function Instance** button.
3. Choose an easy to remember name for your function.
4. On the function dropdown menu, select the **Massive Redirect [Global]** function.

This action will load the **Arguments** tab, where you can add the parameters to execute your application.

:::note
You have several sections on the **Arguments** tab. This happens because you can configure several different redirections at the same time.
:::

The **Arguments** tab will show a JSON file like the one below:

```json
[
  {
    "from": "https://www.azion.com.br",
    "found": "https://www.azion.com"
  }, {
    "from_regex": "http://www\\.(azion)\\.com$",
    "moved": "https://www.%s.com"
  },{
    "from_regex":"http://www\\.azion\\.com/t/other/([\\w_]+)/([\\w_]+)/([\\w_]+)/$",
    "moved":"https://www.azion.com.br/doc/%3$/%1$/%2$/"
  }
]
```

Where:
1. `from`: this is where you'll pass the previous URL, the one you want to redirect to a new one.
2. `moved`: this is where you'll pass the new URL, the one you want to be the target of your redirect rule. This URL will be used as a permanent redirect to the previous URL.
3. `from_regex`: this option permits you to pass multiple redirections in one command, passing more than one address in one line.
4. `found`: this is the same as *moved*, but in this case you have a temporary redirect to a URL.

:::note
If you forgot to pass either the `moved` and/or `found` keys in the **Args** tab you'll receive an error message with the code `JA001`. 
:::

### Configuring a rule on Rules Engine

Still in the **Applications** page, in the **Rules Engine** tab, you have to configure the rules you want (*criteria* and *behavior*) to apply to run your function.

To do this, select the **Rules Engine** tab and proceed as follow:

1. Add a new rule by clicking on the **+ Rule** button.
2. Give an easy-to-remember name and, optionally, a description to your rule.
3. Select the **Request Phase**.
4. Set a criteria for checking your domain. You'll have something like `if: ${domain} is equal xpto.com`.
5. On the behavior section, on `Then`, select `Run a Function` from the dropdown menu and then select the **Massive Redirect** option according to the name you gave it. 
6. Click the **Save** button.

---