Wildcard Pattern Redirects - Swift Redirects

Wildcard redirects let you fix many URLs at once with a single rule. Use placeholders to catch any text in the "Redirect From" path and send visitors to the right destination—no coding required.

How it works

  • * matches "anything" across one or more path segments.
  • $1, $2, … reuse what the wildcard captured (first match is $1, second is $2, etc.).
  • Rules work on the path part of the URL (everything after your domain).

Example:

From: /blog/* → To: /blogs/news

Any URL that starts with /blog/… will go to /blogs/news.

Common recipes (copy & use)

Move an entire folder

From: /old-collection/*

To: /collections/new-collection

Use when every page under /old-collection/ should point to one place.

Preserve the article/product slug

From: /blog/*

To: /blogs/news/$1

/blog/how-to-grow → /blogs/news/how-to-grow

Rename a folder and keep sub-paths

From: /pages/*/*

To: /info/$1/$2

/pages/help/shipping → /info/help/shipping

Collapse many product URLs into one

From: /products/*

To: /collections/all

Great when products were deleted.

Move brand pages and keep the brand name

From: /brand/*

To: /collections/$1

/brand/nike → /collections/nike

Fix a wrong top-level path

From: /blog/*

To: /blogs/$1

/blog/tips/bfcm → /blogs/tips/bfcm

Legacy PHP to Shopify

From: /*.php

To: /

/index.php → / (or send to the right modern page)

Tips & best practices

  • Use 301 (permanent) for moved content—best for SEO.
  • One rule beats many: create a wildcard instead of dozens of single redirects.
  • Order matters: keep specific rules above broad ones (if your app supports rule priority).
  • Avoid loops: don't redirect /a/* → /a/$1.
  • Test first: try a few example URLs to confirm they land correctly.
  • Query strings: If you need to keep UTM or query parameters, ensure your rule or app setting preserves them.

Quick starter table

Goal Redirect From Redirect To Result Example
Move blog to new handle /blog/* /blogs/news/$1 /blog/sale → /blogs/news/sale
Merge all brand pages /brands/* /collections/$1 /brands/adidas → /collections/adidas
Retire a folder /outlet/* /collections/sale /outlet/jackets → /collections/sale
Keep deep paths /help/*/* /support/$1/$2 /help/shipping/rates → /support/shipping/rates
Clean up PHP /*.php / /about.php → /

FAQs

Will this pass SEO value?

Yes. use 301. Search engines transfer most ranking signals from the old URL to the new one.

Does * include slashes?

Yes. It captures across path segments. Use multiple wildcards if you want to map each segment to $1, $2, etc.

Can I keep the captured text?

Yes—use $1, $2 in your "Redirect To" field to re-insert what the * matched.

What about trailing slashes?

Treat /path and /path/ consistently. If both exist, add a rule that covers the variant you receive traffic on or set a canonical preference site-wide.

Popular Post

Back to blog