ui-router-server / prerender / redirectPages
Function: redirectPages()
function redirectPages(options?): RulesWriter;Defined in: redirect-pages.ts:144
A `rules` writer for static hosts with no redirect rules, such as GitHub Pages or a plain bucket: each line becomes a page at <from>/index.html that sends the browser to its to. The page answers 200, so the line's status never reaches the host; its canonical link tells search engines the content moved.
The first line for a page wins, as in _redirects, so a path's two spellings share one page. A line between a path's two spellings, as a mount's trailing-slash policy adds, writes nothing: its page would be its target's own, and the host serves that at both spellings.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | RedirectPagesOptions | the base outDir is served at, whether to write _redirects too, and the page template |
Returns
the writer to pass as rules
Throws
an Error, when the writer runs, for a line whose page would replace one prerender wrote
Throws
an Error, when the writer runs, for a line whose from is a pattern or lies outside base
Example
import {
prerender,
type PrerenderOptions,
redirectPages,
} from 'ui-router-server/prerender';
declare const { mounts, paths, render, write }: PrerenderOptions;
await prerender({ mounts, outDir: 'dist', paths, render, write, rules: redirectPages() });