Shopify themes, liquid, logos, and UX
Hi all,
I'd like to re direct my homepage to the collections page. I cant seem to do this from navigation and url redirects. Essentially what i want is when you go to https://shop.prettylittlepeaches.com/ i want it redirected to https://shop.prettylittlepeaches.com/collections/all
Is there any code i can put in the edit code to do this? Im using dawn theme. Thanks in advance.
Solved! Go to the solution
This is an accepted solution.
I edited the code and this seems to work. I added this to top of head tag
{% if template == 'index' %}
<script>
window.location.href = "COLLECTION_PAGE_URL _HERE";
</script>
{% endif %}
Hi @mostafamoussa
Please add this code before </head> tag.
{% if template == index %}
<script>
window.location.href = "COLLECTION_PAGE_URL _HERE";
</script>
{% endif %}
This did not seem to work, can you be more specific on placement? the collections page url is https://shop.prettylittlepeaches.com/collections/all
can you please share your theme.liquid file code?
I'm trying to accomplish the same thing on my website. Redirect from my homepage (dawn theme) to another page on my website.
This is an accepted solution.
I edited the code and this seems to work. I added this to top of head tag
{% if template == 'index' %}
<script>
window.location.href = "COLLECTION_PAGE_URL _HERE";
</script>
{% endif %}
Works for me, however it breaks editing the original "Home Page" shopify becomes stuck in infinite loop, however if you simply change away from that page it's works fine.
works for me thanks a lot 😀
Hi, this solution does not work for me! I pasted the code under the head tag inside the theme.liquid file but the redirect does not work. Can someone help?
I know this is old but incase anyone faces this issue, make sure to include single quotes around the index, as below:
{% if template == 'index' %}
It goes ABOVE, the head tag, not under.
(And don't forget to put the single quotes around index )
e.g.
{% if template == 'index' %}
<script>
window.location.href = "your-domain-name-or-target-url";
</script>
{% endif %}
<head>
need to include single quotes around index as so: {% if template == 'index' %}
You're a Godsend
Is there a way to do this do it is a 301 redirect? Google doesn't follow these types of redirects and this caused my home page to still get indexed and the page it redirects to get deindexed.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025