# Rule Example

## Overview

For this example, we will create a Rule within a Redirect Response Mode configuration.&#x20;

## Redirect Rule Example

<figure><img src="/files/5br2fNa7bYDOzi26eKpi" alt=""><figcaption><p>Ruleset Example</p></figcaption></figure>

### How the Ruleset works

In this example, we have created two Rule Groups. The Rule Groups are processed in order.&#x20;

#### User scans an NFC tag for the first time

The user scans a tag for the first time and therefore the scan count is 1. As the scan count is less than 5, then the first Rule Group will be matched and the Rule Group URL : <https://seritag.com> will be the response. Therefore, the user scanning the tag will be redirected to our seritag website.&#x20;

#### User scans an NFC tag for the 5th time

In this instance, the scan count is now 5. The first Rule Group no longer matches so ixkio will proceed to the second Rule Group.&#x20;

This has two Rules. The scan must be from an NFC tag ***and*** the scan count is less than 10.&#x20;

In this instance, the scan would match the second Rule Group and the Rule Group URL : <https://seritag.com/learn/> would be returned.&#x20;

#### User scans an NFC tag for the 11th time

Now, neither the first or second Rule Groups would match and the response would default to the 'Rule Set Default URL'. In this example, the response returned would be <https://ixkio.com>. Therefore, the user scanning the tag would be redirected to our ixkio website. &#x20;

### QR Code Scenario

If the first four scans were from an NFC tag and the fifth scan was from a QR code, then the scan count would still be five (as ixkio's scan count is for both NFC and QR).&#x20;

However, while the scan count is less than 10, the fifth scan was not from an NFC tag and therefore the second Rule Group would not match.&#x20;

The response would therefore default to the Rule Set Default URL.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixkio.com/features/rules/rule-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
