A WordPress site is being replatformed onto a Pages project. The old site has 4,200 individual redirects in .htaccess from a decade of slug renames, plus a pattern that should send every /blog/category/* to /topics/$1. Cloudflare offers two tools: Single Redirects with full expression filters, and Bulk Redirects for long literal lists. They overlap in capability but not in cost or maintainability. This article is the decision and the migration.
How to verify
List the redirect rules already on a zone, and the Bulk Redirect lists at the account level (lists are account-scoped and attached to zones via a list reference):
# Single (dynamic) Redirect Rules at the zone level
curl -s -H "Authorization: Bearer $CF_API_TOKEN" \
"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets" \
| jq '.result[] | select(.phase == "http_request_dynamic_redirect")'
# Bulk Redirect lists at the account level
curl -s -H "Authorization: Bearer $CF_API_TOKEN" \
"https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/rules/lists?kind=redirect" | jq
# Curl a known-redirected path to see the chain
curl -sIL "https://example.com/old-slug" | grep -iE 'HTTP|location'
The cf-ray header on the redirect response confirms Cloudflare emitted it (rather than the origin), and the Location header shows the resolved target.
What’s happening
Both Redirect Rule types live in the same phase of the pipeline — http_request_dynamic_redirect — and fire before Cache Rules, Configuration Rules, and Origin Rules. They differ in how the source-to-target relationship is expressed. A Single Redirect uses a filter expression and a (static or dynamic) target — one rule per pattern. A Bulk Redirect uses a Redirect List, where each row is a literal source-url → target-url mapping with a status code and a couple of flags — one entry per URL.
The practical rule of thumb: if you would write a regex or a wildcard, use Single Redirects. If you have a flat CSV of source URLs and target URLs that don’t share structure (the kind of list a CMS migration produces), use Bulk Redirects. Mixing the two is fine — Bulk Redirects evaluate alongside Single Redirects in the same phase, with priorities determined by rule order and list priority within a list.
Decision
The shape of the redirect set tells you which to pick.
-
Pick Single Redirects when there’s a pattern. A Single Redirect is one expression and one target. Example: every
/blog/category/<anything>should go to/topics/<anything>with a 301:When: (http.host eq "example.com" and starts_with(http.request.uri.path, "/blog/category/")) Then: Redirect to... Target → Dynamic → concat("https://example.com/topics/", substring(http.request.uri.path, 16)) Status code → 301 Preserve query string → onThe
16is the length of/blog/category/. The dynamic target language supportsconcat,substring,regex_replace,lower,upper. The expression supports the same operators as the WAF —eq,starts_with,ends_with,matches(regex),in, and boolean compounds. -
Pick Bulk Redirects when there’s a long flat list. Bulk Redirects use a Redirect List — a CSV upload (or API push) where each row is
source_url,target_url,status_code,preserve_query_string,preserve_path_suffix,include_subdomains,subpath_matching. The list is stored at the account level; zones reference it via aredirectruleset that includes the list. Example list:https://example.com/2018/old-product, https://example.com/products/new, 301, true, false, false, false https://example.com/2019/sunsetted, https://example.com/, 302, false, false, false, false https://example.com/forum, https://community.example.com, 301, true, false, false, falseLimits matter: a single list can hold thousands of entries (the exact limit varies by plan; Free zones get a smaller list, Enterprise gets the largest). Multiple lists can attach to one zone for namespacing — one list for marketing, one for legal pages, one for the migration cohort.
-
Choose the status code deliberately.
301(permanent) is what you want for content moves — search engines transfer ranking to the new URL.302(temporary) is for A/B tests or maintenance windows where the redirect should not be cached forever.307/308preserve the request method (a POST to/oldbecomes a POST to/new) — only relevant for API endpoints, never for browser navigation. Default to301and only deviate with a reason. -
Preserve path and query string by default. Both rule types have toggles. For a content move,
preserve_query_string: trueis almost always right (campaign tracking, analytics, search params should survive).preserve_path_suffixon a Bulk Redirect treats the source as a prefix —/blog → /articleswith the toggle on means/blog/2024/postbecomes/articles/2024/postautomatically. With the toggle off, only the exact source URL redirects. -
For
.htaccessmigrations, run a one-time conversion. A common shape in WordPress.htaccess:Redirect 301 /old-slug /new-slug RedirectMatch 301 ^/blog/(.*)$ /articles/$1The first form is a Bulk Redirect candidate (one row per directive). The second is a Single Redirect (one rule, regex-backed). A short shell script can split a
.htaccessinto a CSV plus a list of regex patterns:# Extract literal Redirect 301 lines → CSV for Bulk Redirects grep -E '^Redirect 301 ' .htaccess \ | awk '{print "https://example.com"$3",https://example.com"$4",301,true,false,false,false"}' \ > bulk-redirects.csv # RedirectMatch lines → review by hand, convert to Single Redirects grep -E '^RedirectMatch' .htaccessPush the CSV to a Redirect List, attach it to the zone, and write the handful of Single Redirects manually. Verify with
curl -sILagainst a sample of 20 URLs from each bucket before flipping DNS.
Common pitfalls
- Redirect loops happen when the target also matches the source filter. A rule that sends
/old/*to/old/new/foowill loop because the target also starts with/old/. Either tighten the filter (http.request.uri.path eq "/old/foo") or make the target a different path entirely. - Bulk Redirect priority is by list order, not list age. If two lists attached to a zone both contain the same source URL, the list with the lower priority number wins. Audit list priorities when adding a new list.
- A 302 is treated as cacheable by some clients. If the redirect must be revisited daily (A/B test reassignment), use
302and setCache-Control: no-storevia a Response Header Modification rule on the redirect responses. - Preserving path suffix is off by default in Bulk Redirects. A row of
/blog → /articleswithout the toggle redirects exactly/blog, not/blog/anything. The default surprises people moving from.htaccessRedirect 301, which has prefix-matching behaviour. - Subdomain redirects need
include_subdomains. A row forhttps://example.com/oldwon’t fire onhttps://www.example.com/oldunless the flag is on. For wildcard hostnames, use a Single Redirect withhttp.host matches "^(www\\.)?example\\.com$".
In our engagements, the long tail of CMS-migration redirects always lives in a Bulk Redirect list — it’s the layer marketing can audit without engineering, and it scales without rule-count pressure. Pattern redirects stay in Single Redirects so the expression sits next to the cache and origin rules that share the same filter language. Stack Harbor owns the Cloudflare edge configuration end to end as part of managed operations.