Build Redirect Rule Conditions
Every redirect rule starts with one or more conditions. A condition checks something about the incoming traffic, such as its landing page URL, country, or device type, and decides whether the rule applies. Read more about how to Create a Redirect Rule.
Condition attributes
The table below lists the condition attributes you can use in a rule.
Condition operators
One of the most useful condition attributes is Landing Page, since it lets you build conditions, and redirects, based on the incoming URL. The operators listed below are for the Landing Page attribute. The operators available depend on which attribute you pick: most attributes offer a smaller set. For example, Mobile Fallback only offers is and is not.
Combine conditions
You can combine multiple conditions using AND:
Use AND when more than one thing needs to be true at the same time, for example, traffic from a specific country and on a specific device type.
Select Add another to add a separate, independent condition that meets either the first condition or the new one. It doesn't need to meet both. This means that Add another is like an OR condition.
The next two sections show how to create a redirect rule using the Contains and Matches operators.
Use the contains operator
The simplest way to branch traffic by URL is with two separate rules using contains. Say you want anyone landing on a UK page to get one query parameter, and anyone landing on a US page to get another.
Rule 1, UK traffic:
Condition:
Landing Pagecontains/uk.Action: Redirect to the same URL, with
?a=123added to the end.
Rule 2, US traffic:
Condition:
Landing Pagecontains/us.Action: Redirect to the same URL, with
?a=456added to the end.
Each rule checks the incoming URL for one piece of text (either /uk or /us). If it finds the text, the redirect rule sends the visitor onward with an extra parameter added on.
This works well for simple either/or splits, but this technique can't reuse parts of the original URL. For that, you need to use matches.
Use the matches operator
The matches operator lets you write a pattern for the whole URL, and mark one part of it with a placeholder, written as {PLACEHOLDER}, so you can reuse that exact piece later in the redirect.
Last updated
Was this helpful?

