Skip to content

ui-router-server / redirects / RedirectRule

Interface: RedirectRule

Defined in: redirects.ts:56

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

PropertyTypeDescriptionDefined in
patternstring | RegExpPathnames to redirect: a matcher pattern (whose params carry into the target) or a RegExp.redirects.ts:58
tostring | RedirectTargetWhere matching pathnames go — a state name, or a RedirectTarget with params.redirects.ts:60