Hello everyone,
How to redirect all internal url links in one time? For example if i have url:
https://abc.com/collections/all/
and I want redirect to:
https://abc.com/collections/all
that it would be without /
Thanks!
Hello everyone,
How to redirect all internal url links in one time? For example if i have url:
https://abc.com/collections/all/
and I want redirect to:
https://abc.com/collections/all
that it would be without /
Thanks!
Have you tried using Shopify’s redirects? https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect
Honestly, I’ve never tried it but my gut feeling is that since /collections/all and /collections/all/ are still in a way the same route, it might just redirect back to itself over and over again on repeat forever. Maybe not though, and it might be worth giving a shot.
There’s also a front end solution, but I wouldn’t necessarily recommend that you do it. But it works so you can use it if you want. You could use window.location.pathname to do it. Here’s a function that would redirect if the pathname ends with a / but only if it’s not the homepage because the pathname is always / for the homepage. Just add it as high as possible on the site to prevent the whole page from having to load twice.