> For the complete documentation index, see [llms.txt](https://docs.aisera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aisera.com/aisera-platform/tenant-setup/aisera-platform-configuration/tenant-configuration-settings/knowledge-serving.md).

# Knowledge Serving

The **Knowledge Serving** settings control how the platform handles knowledge base (KB) article URLs before delivering them to users. These settings are tenant-wide and apply across all bots and channels in your Aisera instance. You can find them at **Settings > Configuration > Knowledge Serving**.

### KB URL Rewrite

| **Type**    | Text field (JSON)               |
| ----------- | ------------------------------- |
| **Default** | `{"match":null,"rewrite":null}` |

Transforms KB article URLs before they reach users, redirecting internal or legacy source URLs to a public-facing address. Set `match` to a Java regex pattern and `rewrite` to a template string; Aisera applies the pattern to each article's source URL and replaces the matched portion using the template. When both fields are null, no rewriting occurs and URLs are served as-is. Use this when your KB source system stores articles at internal or API-style URLs that differ from the URLs you want users to see or click.

The `rewrite` template supports capture group references such as `${MG_1}` and `${MG_2}`, the article title via `${kbTitle}` or `${kbTitle.replace(' ', '-')}`, and session variables via `${sessionVar.get('locale')}`. Rewrite rules apply across all KB serving paths, including conversation fulfillment and flow execution.

```json
{
  "match": "internal.example.com/kb/articles/([0-9a-zA-Z]+)/view",
  "rewrite": "support.example.com/s/article/${kbTitle.replace(' ', '-')}"
}
```

{% hint style="info" %}
You can add an optional `appendIfNotMatch` field to the JSON object. When `match` does not find a result, this string is appended to the original URL. This field is not included in the default UI value but is supported.&#x20;
{% endhint %}

### Enable URL Click Tracking

| **Type**    | Checkbox |
| ----------- | -------- |
| **Default** | Enabled  |

Records which KB articles users open from bot responses by replacing article links with a tracked redirect URL before delivery. Use this to measure self-service resolution rates and identify high-engagement content. Disable it if your organization blocks external redirects or if you need unmodified article URLs to appear in conversation logs.

{% hint style="info" %}
Audit logs always store the original article URL regardless of this setting. This setting is tenant-wide and cannot be scoped to individual bots or channels.
{% endhint %}
