Given a character vector of URLs and a redirect data frame,
resolves each URL to its final destination by following redirect chains.
Unlike resolve_redirects, this function does not require an
edge list – it works directly on a list of URLs. This helper is
redirect-only; use [resolve_canonical_urls()] for `rel=canonical` folding
or [resolve_folded_urls()] for composed redirect plus canonical folding.
Arguments
- urls
Character vector of URLs to resolve.
- redirects_df
A data frame containing redirect rules.
- redirect_from_col
Character, name of the source column. Default
"from".- redirect_to_col
Character, name of the target column. Default
"to".- duplicate_from_policy
How to handle conflicting redirects. Passed through to redirect preprocessing. Default
"strict".- loop_handling
How to handle redirect cycles. Default
"error". Use"prune_loop"or"break_arrow"to resolve despite loops.
Value
A data frame with columns:
- original
The input URL.
- resolved
The final destination after following all redirects.
- changed
Logical, whether the URL was modified by a redirect.
Examples
redirects <- data.frame(
from = c("A", "B", "C"),
to = c("B", "C", "Final")
)
# Resolve specific URLs
resolve_urls(c("A", "B", "X"), redirects)
#> original resolved changed
#> 1 A Final TRUE
#> 2 B Final TRUE
#> 3 X X FALSE
# X is not in the redirect map, so it stays as-is