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

# Function: redirectPage()

```ts
function redirectPage(line): string;
```

Defined in: [redirect-pages.ts:62](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/redirect-pages.ts#L62)

The default redirect page for one line: a `location.replace` that carries
the request's query and fragment when the target has none of its own, a
meta refresh and a plain link for browsers without script, a canonical link
to the target, and `noindex`. The target is escaped in markup and script.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `line` | [`RedirectLine`](../interfaces/RedirectLine.md) | the rules line; the page uses its `to` |

## Returns

`string`

the page's HTML

## Example

```ts
import { redirectPage, redirectPages } from 'ui-router-server/prerender';

declare const analytics: string;

const rules = redirectPages({
  page: (line) => redirectPage(line).replace('</head>', `${analytics}</head>`),
});
```
