View source: R/resolve_redirect_urls.R
| resolve_redirect_urls | R Documentation |
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.
resolve_redirect_urls(
urls,
redirects_df,
redirect_from_col = "from",
redirect_to_col = "to",
duplicate_from_policy = c("strict", "first_wins", "last_wins", "most_frequent",
"prune_source", "resolve_if_consistent"),
loop_handling = c("error", "prune_loop", "break_arrow")
)
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
|
redirect_to_col |
Character, name of the target column. Default
|
duplicate_from_policy |
How to handle conflicting redirects. Passed
through to redirect preprocessing. Default |
loop_handling |
How to handle redirect cycles. Default |
A data frame with columns:
The input URL.
The final destination after following all redirects.
Logical, whether the URL was modified by a redirect.
Other URL-vector resolvers:
resolve_canonical_urls(),
resolve_folded_urls()
redirects <- data.frame(
from = c("A", "B", "C"),
to = c("B", "C", "Final")
)
# Resolve specific URLs
resolve_redirect_urls(c("A", "B", "X"), redirects)
# X is not in the redirect map, so it stays as-is
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.