Shopify Wildcard Redirect Guide with Redirect Ninja

Learn how to use Shopify redirect wildcards to efficiently manage multiple URL redirects in your store. Instead of creating individual redirects for each broken link, use powerful wildcard rules with asterisks (*) anywhere in your URL patterns to automatically handle similar URLs. Create flexible patterns that preserve important parts of your URLs while redirecting customers to the right pages.

Jeff

Monday, March 24, 2025

Make sure to download Redirect Ninja - Easy 404 Fix and install it on your Shopify store.

What Are Wildcard Redirects & Why Use Them?

When managing a Shopify store, you often need to handle URL changes efficiently. Wildcards are powerful tools that match multiple URLs following similar patterns. Instead of creating individual redirects for each broken link, you can create a single wildcard rule that handles many similar URLs automatically.

This dramatically reduces your workload, especially when dealing with URL structure changes or archived collections. Instead of creating dozens, hundreds, or even thousands of individual redirects, you set up one wildcard rule that automatically handles all matching URLs.

How to Set Up Shopify Wildcards Redirects

Basic Syntax

Wildcard rules in Redirect Ninja use an asterisk (*) as a placeholder character that can match any sequence of characters in a URL path segment.

With our latest update, you can now use multiple wildcards anywhere in your URL patterns, giving you even more flexibility!

Valid examples:

  • /products/* matches any URL that starts with "/products/" followed by anything
  • /collections/*/products/* matches products in any collection
  • /blog/*-news matches any blog post with a URL ending in "-news"
  • /sale-* matches any URL path starting with "sale-"

Pattern Matching Rules

Important rules for wildcard patterns in Redirect Ninja:

  1. Wildcards (*) can now be placed anywhere in the pattern
  2. Multiple wildcards are supported in a single pattern
  3. Each wildcard matches any characters except slashes within a path segment
  4. Consecutive wildcards (like **) are not allowed
  5. Wildcards only apply to the path portion of URLs, not query parameters

For example:

  • If your pattern is /collections/*/products/*
  • It will match broken URLs like:
    • /collections/summer/products/sunglasses
    • /collections/winter/products/hats
    • But NOT /collections/summer/best/products/sunglasses (since * doesn't match across slashes)

Using Wildcards in "From" and "To" URLs

One of the most powerful features of Redirect Ninja is the ability to use wildcards in both the "From" and "To" patterns. This gives you complete flexibility in how you handle redirects.

Flexible Wildcard Options

You can use wildcards in several ways:

  1. Fixed Destination Redirects: Use wildcards only in your "From" pattern with a static "To" URL:
    • From: /old-products/*
    • To: /collections/all
    • This redirects all matching URLs to a single destination
  2. Dynamic Redirects: Use wildcards in both patterns to preserve parts of the original URL:
    • From: /old-products/*
    • To: /products/*
    • This preserves the product name/handle when redirecting

Choose the approach that best suits your specific redirection needs!

Capturing and Preserving URL Parts

When you use wildcards in the "From" pattern, each wildcard captures a specific part of the URL. These captured parts are then used in the corresponding position in the "To" pattern.

For example:

  • From: /old-site/products/*
  • To: /products/*

In this example:

  1. The wildcard in the "From" pattern captures the product name
  2. The same information is inserted in the "To" pattern
  3. A URL like /old-site/products/blue-shirt would redirect to /products/blue-shirt

Multiple Wildcards and Pattern Matching

When using multiple wildcards, Redirect Ninja matches them in order. The first wildcard in the "From" pattern corresponds to the first wildcard in the "To" pattern, and so on.

For example:

  • From: /collections/*/products/*-old
  • To: /collections/*/products/*-new

In this example:

  1. The first wildcard captures the collection name
  2. The second wildcard captures the product name (without the "-old" suffix)
  3. A URL like /collections/summer/products/sunglasses-old would redirect to /collections/summer/products/sunglasses-new

Important Limitations

Remember these key points when working with wildcards:

  • Wildcards only match within path segments (between slashes)
  • Each wildcard captures only the characters in its segment
  • Wildcards don't match across slashes
  • Query parameters (after ?) are not part of wildcard matching

Testing Your Wildcard Rules

Redirect Ninja now includes a powerful Wildcard Testing Tool that lets you see exactly how your wildcard rules will work in practice.

Redirect Ninja Wildcard Redirect Testing Tool

How to Use the Wildcard Testing Tool

  1. Navigate to the Wildcards section in your Redirect Ninja dashboard
  2. Scroll down to find the "Test Your Wildcard Rules" card
  3. Enter any URL you want to test in the input field
  4. Click "Test URL" to see the results

What the Testing Tool Shows You

When you test a URL, the tool will:

  • Show you if the URL matches any of your wildcard rules
  • Display which specific rule it matched
  • Show you exactly where the URL would redirect to
  • Help you troubleshoot why a URL might not be matching as expected

This tool is invaluable for:

  • Verifying your wildcard rules work as intended
  • Ensuring your redirects preserve the right parts of URLs
  • Checking for conflicts between different wildcard rules
  • Understanding which rule takes precedence when multiple rules could match

Redirect Precedence Order

When a 404 error occurs, Redirect Ninja checks for redirects in the following order:

  1. Normal (Exact Match) Redirects
    • These are redirects that match the exact URL path
    • Highest priority, checked first
    • Most specific type of match
  2. Wildcard Redirects
    • Checked if no exact match is found
    • Matches URL patterns with * placeholders
    • More specific wildcard patterns (fewer *) take precedence over more generic ones
  3. Automatic Redirects
    • Lowest priority, checked last
    • Used for "live redirect" feature
    • Redirects all unmatched 404s to a specified page

Common Shopify Wildcard Redirect Use Cases

Platform Migration Examples

  1. BigCommerce to Shopify Migration
    • From: /shop/products/*.html
    • To: /products/*
    • Captures old BigCommerce product URLs ending with .html and redirects to Shopify's clean URL structure
  2. WooCommerce to Shopify Migration
    • From: /product-category/*/*
    • To: /collections/*-*
    • Redirects nested WooCommerce category pages to combined Shopify collections
  3. Magento to Shopify Migration
    • From: /catalog/product/view/id/*
    • To: /products/*
    • Handles Magento's numeric ID-based URLs to Shopify's handle-based structure

URL Structure Changes

  1. Rebranding Product Lines
    • From: /products/old-brand-*
    • To: /products/new-brand-*
    • Useful when changing product naming conventions while keeping the rest of the URL the same
  2. Consolidating Seasonal Collections
    • From: /collections/*-2022
    • To: /collections/archive-*
    • Perfect for archiving multiple seasonal collections into a single archive section
  3. Reorganizing Blog Categories
    • From: /blogs/news/*-tips
    • To: /blogs/tips/*
    • Moves all tip-related blog posts to a dedicated tips blog

Need help with wildcard rules? Contact support through the chat widget in your Redirect Ninja dashboard.

Take your Shopify store to the next level

Unlock Your Store's Full Potential with Custom Apps, Themes, and Integrations.

Let's talk