All things Shopify and commerce
Hi all,
I would like to remove < myshopify.com/collections > and < myshopify.com/products > page, so that even if these pages were indexed in google, no one could access and see the contents inside.
Thank you!
Solved! Go to the solution
This is an accepted solution.
Ok let me check
You cannot hide them you can use a redirect for these two pages to the homepage.
Thanks
@Liquid_xPert_SJ
Thanks so much! Could you share your knowledge on how to redirect those two pages to the homepage?
This one bothered me quite long so if there is any way to do that, that would be so helpful!!
@inter_b2b ok hold on plz let me share
<script type="text/javascript">
jQuery( document ).ready(function($) {
if (window.location.href.indexOf('?/collections/all=') > 0) {
window.location.href = '/';
}
else if (window.location.href.indexOf('?/products=') > 0) {
window.location.href = '/'; //Will take you to Google.
}
});
</script>
Please add this code into your theme.liquid file before the </body> tag
Share your store url
This is an accepted solution.
Ok let me check
@Liquid_xPert_SJ
after adding below as you advised, it works perfectly 🙂 Thanks tremendously!
<script> let url = window.location.href; if (url.includes('/products')) { location.href = '/'; } </script>
Any chance I can do the same on /collections page?
even if not possible, I am still content on what's been accomplished so far. This is the furthest I came!! Thanks indeed.
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025