How To Redirect Your 404 Page To The Home Page In Shopify
Redirecting your 404 not-found pages to your online store’s home page can help reduce the bounce rate and give your users a chance to discover other useful content on your website.
In this article, I’ll guide you on how to redirect your 404 page to your home page in Shopify, step by step.
- From your Shopify admin, go to Online Store > Themes.
- Find the theme you want to edit, and then click Actions > Edit code.
- In the Templates directory, click 404.liquid.
- Removing all existing code, then inserting the below code to this file1{% layout none %}<script>window.location.replace("/");</script>
- Click Save and you are done.
If you are using a Shopify 2.0 theme, you must delete the 404.json file, and create the new 404.liquid file, then follow the guide above.
To delete the 404.json file, you click on this file to open it. A trash icon will appear, click on this icon and click on Delete file on the popup open.
To create a new 404.liquid file, click on Add a new template, choose 404 and liquid for the Template type, then click Done on the popup open.
Now, when a page is not found, instead of showing a 404 page, the visitors will be redirected to your Shopify home page.
Seriously it was really helpful.
hi there, I’m getting this error when i use the above code: “Invalid JSON: unexpected character (after ) at line 1, column 3
“
Great, Thanks