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

# Function: compileRedirects()

```ts
function compileRedirects(table): (pathname) => string | null;
```

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

Compiles a redirect table into an evaluator: pathname in, redirected path
out — or null when the pathname does not redirect (no rule or redirecting
state matched, target params were invalid, or the redirect lands where it
started). Unknown or unaddressable targets and redirect cycles are
configuration errors and throw here, not at evaluation.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `table` | [`RedirectTable`](../interfaces/RedirectTable.md) |

## Returns

(`pathname`) => `string` | `null`
