301 Redirect for all 404 error pages

Hi everyone,

I’m trying to find a way to handle 404 pages more efficiently on my Shopify store. Ideally, I’d like to dynamically redirect users (with a redirect 301) from 404 pages to another page.

I know I can create manual URL redirects in the admin, but is there any way to automate this for pages that return 404 errors?

I’ve considered using JavaScript in the 404.liquid template, but since that would be a client-side redirect, it wouldn’t count as a true 301 for SEO purposes.

Is there any workaround or app that allows server-side 301 redirects based on the requested URL? Preferibly without using any app, but if it’s not any other way, using any app.

Thanks in advance!

By default, Shopify does not have an automatic function.

The app I use to automate redirects is: https://apps.shopify.com/broken-link-manager

Additionally, in more technical terms, I have some automations to streamline this process.

In the 404 template, I have a script (JavaScript) that sends the 404 routes/links to my server. On my server, I process these routes with the GraphQL API to create the redirects automatically like this: if it’s a product to /collections/all, if it’s a collection to /collections/all, and if it’s something generic to the homepage. I had to customize this to achieve 100% automation.

I hope this helps you.