---
url: >-
  https://lit-ui-router.dev/reference/ui-router-server/redirects/interfaces/RedirectRule.md
---
[ui-router-server](../../index.md) / [redirects](../index.md) / RedirectRule

# Interface: RedirectRule

Defined in: [redirects.ts:109](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/redirects.ts#L109)

A when()-style rule: pathnames matching `pattern` redirect to `to`. Rules
evaluate before state redirects, in declaration order. A string pattern
compiles as a matcher pattern and its extracted params carry into the
target (explicit target params win); a RegExp contributes no params.

Server redirects assume path-location clients. Hash-location apps keep
route state in the fragment the server never sees, so a mount-root rule
would rewrite the visible path on every entry — serve the shell at the
mount root instead.

## Properties

| Property | Type | Description | Defined in |
| ------ | ------ | ------ | ------ |
|  `pattern` | `string` | `RegExp` | Pathnames to redirect: a matcher pattern (whose params carry into the target) or a RegExp. | [redirects.ts:111](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/redirects.ts#L111) |
|  `to` | `string` | [`RedirectTarget`](RedirectTarget.md) | Where matching pathnames go — a state name, or a [RedirectTarget](RedirectTarget.md) with params. | [redirects.ts:113](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/redirects.ts#L113) |
