Redirect wildcards
A wildcard redirect gives site administrators the ability to specify rules for redirecting multiple pages at once.
Format#
A wildcard starts with a : and is followed by an alias, such as /products/:productid. Splats are a special type of wildcard defined by ending a source url with /*. The asterisk indicates the splat will match whatever follows after.
Take /products/* for example. It matches /products/electronics/radio, /products/radio, and /products itself. The part of the path that the splat matched is named :splat in the target, so a target of /inventory/:splat results in /inventory/electronics/radio. One splat redirect covers a whole section of a site, including the section's own landing page.
Wildcard rules#
- A wildcard represents an entire path segment that could be any value
/products/:productidwould not match/products/electronics/radiobecause the wildcard:productidcan only match a single path segment
- A splat matches any number of path segments, including none at all
/products/*matches/products/electronics/radioand also/productson its own, so a single redirect covers the whole section- When the splat matches nothing, it contributes nothing to the target:
/products/*->/inventory/:splatsends/productsto/inventory
- Only a
*at the end of a source url is a splat- In
/products/*/archive, the*is a literal path segment, not a splat
- In
- A wildcard must start at the beginning of a path segment
- This is valid:
/products/:productid - This is invalid:
/products/prefix:productid
- This is valid:
- To pass the wildcard information along to the target, it must have a matching wildcard
- This is valid:
/products/:productid->/inventory/:productid - This is invalid:
/products/:productid->/inventory/:productbecause the wildcard names don't match - A splat is named
:splatin the target:/products/*->/inventory/:splat
- This is valid:
- A target with no wildcard sends everything the source matched to the same place
/products/*->/catalogsends/products/radioand/products/electronics/radioboth to/catalog
Project map nodes#
If you configure a project map node to be dynamic, the path segment is considered a wildcard for redirects. This means it must follow the same rules listed above when using a project map node as a source or target.