# Redirecting Traffic between Servers through the Rules Tab

## Environment

|                 |                    |
| --------------- | ------------------ |
| Product         | Fiddler Everywhere |
| Product Version | 1.0.0 and above    |

## Description

How can I use the [**Rules**](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/modify-traffic-with-rules) tab for redirecting traffic from one server to another?

## Solution

To accomplish this scenario, we can use a basic redirect or a rule, which utilizes regex and regex variables.

### Using a Basic Redirect

To redirect traffic from one server to another, implement a basic redirect rule.

**Match Condition**: URL > Contains > `https://docs.telerik.com/fiddler-everywhere/introduction`
**Action**: Update URL > Set Value > `http://localhost:4000/fiddler-everywhere/introduction`

### Redirecting with Regex

To create more complex redirect rules, use the Fiddler Everywhere regex support for creating **Match Conditions** rules and **Actions**.

**Match Condition**: URL > Regular Expression > `(.*)docs.telerik.com/(.*)`
**Action**: Update URL > Regular Expression > Find `(.*)docs.telerik.com/(.*)` + Replace `http://localhost:4000/$2`

![Creating a rule that uses regular expression to change an URL](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/assets/23df00cd44fbbbfe8a9f1d4864a8e96f/rule-with-regex.png)

In the previous example, two regex variables are automatically created. The second one will have as its value everything that comes after the last slash (`/`).

As a result, after applying the above rule, the following example endpoint

```sh
https://docs.telerik.com/fiddler-everywhere/modify-and-filter-traffic/modify-traffic-with-rules
```

will be redirected to

```sh
http://localhost:4000/fiddler-everywhere/modify-and-filter-traffic/modify-traffic-with-rules
```

## See Also

* [Sample Rules Presets](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/rules-presets)
* [Using Breakpoints](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/breakpoints)
* [Understanding the Matching Conditions and the Actions](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/conditions-and-actions#conditions)
* [Understanding the role of Final and Non-Final Actions](https://www.telerik.com/fiddler/fiddler-everywhere/documentation/modify-and-filter-traffic/conditions-and-actions#final-and-non-final-actions)
