Overview of wildcard redirects in Shopify

Wildcard redirects (also known as pattern redirects) allow you to redirect all URLs that match a pattern to a new location. While standard URL redirects in Shopify must match the URL exactly, wildcard redirects allow you to do things like redirect all URLs that start with some text to a new location.

Since wildcard redirects are not supported natively by Shopify they function a little differently than URL redirects. When a visitor visits your Shopify store and access a URL that does not exist, the app will quickly check to see if there's a wildcard redirect that matches the URL. If there is, it will tell the visitor's browser to use that URL instead.

Parts of a wildcard redirect

Like URL redirects, wildcard redirects have two parts: 'redirect from' and 'redirect to'.

'Redirect from' needs to include an asterisk in the part of the URL that should match on anything. For example, to match all URLs that start with '/old/', you can use the value /old/* .

The 'redirect to' part of the wildcard redirect behaves the same as it does for URL redirects. You can either use a path that starts with a slash (like /collections/all ) or a full URL if you want to redirect the visitor to another website.

Common uses for wildcard redirects

Here are a few common situations where you might need to use wildcard redirects instead of standard URL redirects.

Redirect visits to all missing product detail pages

If you have unpublished a product from your store visitors will see a 404 error page if they try to access that product's URL. You can use wildcard redirects to send all visitors to missing product pages to another page.

For example, to send all visitors to a list of all your collections you can create a wildcard redirect like this:

  • Redirect from: /products/*
  • Redirect to: /collections/all

You can redirect all broken link visits to a new URL by creating a wildcard redirect with 'redirect from' set to /* . Then anytime a visitor visits a page that does not exist they will be sent to which ever page you select.

Migrating to Shopify

If you are migrating to Shopify you might have a large number of URLs on your old store that no longer exist in Shopify. However you might have links to these URLs in Google, other blogs and social media sites. If these URLs follow a similar pattern you can use wildcard redirects to redirect your visitors to a new URL on your Shopify store.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.