Home > @uniformdev/redirect > getTargetVariableExpandedUrl
getTargetVariableExpandedUrl() function
Given a redirect definition and an incoming URL, calculate what the final outgoing URL is to be. Wildcards in the target are filled from the matching source wildcards; a source splat can be written in the target either as * or as :splat.
isVariable overrides which source path segments count as wildcards. It receives whether the segment is the last one in the source, which is what distinguishes a trailing splat from a literal *; a callback that ignores it cannot match splats. The default accepts both.
Signature:
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
url |
string | |
|
redirectDefinition |
RedirectDefinition['redirect'] | |
|
isVariable |
(pathSegment: string, isLast: boolean) => boolean |
(Optional) |
Returns:
string