Managing Wildcard Redirects
Wildcard Redirects in SEO Manager: A Comprehensive Guide
Wildcard redirects, also called pattern redirects, empower you to reroute all URLs matching a specific pattern to a designated location. Unlike standard URL redirects in Shopify, which necessitate an exact match, wildcard redirects offer the flexibility to redirect URLs based on predefined patterns. For instance, you can redirect all URLs beginning with certain text strings to a new destination.
Given that wildcard redirects aren't inherently supported by Shopify, they operate with slight variations compared to URL redirects. When a visitor attempts to access a non-existent URL on your Shopify store, the system swiftly checks for any matching wildcard redirects. If a match is found, the visitor's browser is instructed to navigate to the specified URL instead.
Components of a Wildcard Redirect
Similar to URL redirects, wildcard redirects consist of two primary components: the 'redirect from' and 'redirect to' fields.
The 'redirect from' field must incorporate an asterisk (/*) in the segment of the URL that should match any content. For instance, to capture all URLs commencing with '/old/', you would input the value /old/.
The 'redirect to' portion of the wildcard redirect operates akin to URL redirects. You can specify either a path starting with a slash (e.g., /collections/all) or a complete URL to redirect visitors to an external website.
Common Applications of Wildcard Redirects
Below are some typical scenarios where wildcard redirects prove indispensable compared to standard URL redirects:
- Redirecting Visits to Missing Product Detail Pages: When a product is unpublished from your store, visitors encountering its URL will encounter a 404 error page. Employing wildcard redirects, you can seamlessly redirect visitors to an alternative page. For instance, to redirect visitors to a list of all your collections, set up a wildcard redirect as follows:
- Redirect from: /products/*
- Redirect to: /collections/all
- Redirecting Broken Links to Homepage: Redirecting all visits to broken links to a designated URL is possible by creating a wildcard redirect with the 'redirect from' field set to /*. This ensures that visitors encountering non-existent pages are directed to your chosen destination.