Re: How To Tagged Page Redirect To Collection Pages

Solved

How To Tagged Page Redirect To Collection Pages

raviray
Visitor
3 0 0

Hello Experts,

I am new to Shopify.

I am trying to redirect the tagged page to the collection/category pages. I've added a URL redirect to the Shopify URL Redirects table but it isn't redirecting to the target path.

Below I have added the way I follow

Settings > Apps and sales channels > click Online store > Click Open sales channel > Navigation > Click URL Redirects > Click Create URL redirect.

Could anyone please guide me on how to redirect tagged pages to collection pages in Shopify?

Thanks in Advance.

Accepted Solution (1)
Akibhusen
Shopify Partner
715 121 148

This is an accepted solution.

Hi,

 

You can't make the tag page 404 as it's just a part of the collection. Tag value will be added at the end of the collection URL and display the products which have the tag value which is rendered in the URL with the collection. 

 

If you delete that tag from the product then also it is not displaying 404 because it is just a filter value that is added in the URL as a part of the parameter.

 

Hope you get the idea of what I want to say here.

View solution in original post

Replies 14 (14)

Akibhusen
Shopify Partner
715 121 148

Hi @raviray,

 

I hope you have an idea about the rules for redirection in Shopify. If you don't have any idea please refer to the below note.

 

Only broken URLs should be redirected. Broken URLs might load a "page not found" placeholder message, or "404" might appear somewhere on the page or in the page title. If the URL still loads a valid webpage, then the URL redirect won't work.

raviray
Visitor
3 0 0

Hi @Akibhusen 
I would like to redirect tagged pages to the actual collection pages. As far as deleting tagged pages on Shopify is concerned, I don't know what to do. 

 

Tagged page URL example: www.mydomain.com/collections/category-name/tagged-page

 

Could please let me know how can I delete tagged pages and make it “page not found”?

 

Once we can able to delete this page then the 301 redirection rule will work in Shopify. 

Akibhusen
Shopify Partner
715 121 148

This is an accepted solution.

Hi,

 

You can't make the tag page 404 as it's just a part of the collection. Tag value will be added at the end of the collection URL and display the products which have the tag value which is rendered in the URL with the collection. 

 

If you delete that tag from the product then also it is not displaying 404 because it is just a filter value that is added in the URL as a part of the parameter.

 

Hope you get the idea of what I want to say here.

raviray
Visitor
3 0 0

Thanks @Akibhusen 

baileywitt3
Shopify Partner
3 0 1

Is there an actual solution to this?

 

I have tried creating redirects in CloudFlare and they still don't work. How can Shopify just block all redirects for non-broken pages?

 

The mess of auto-generated tag pages is an SEO nightmare. 301 redirects would be an easy way to clean it up.

ttbinfo
Excursionist
16 0 1

I’ve been trying to find this out too! If you find a solution, please let me know.

baileywitt3
Shopify Partner
3 0 1

The solution we came up with is a liquid snippet that overwrites the canonical URL for the tag pages and tells search engines we'd rather show a different page instead. Sample code below. You just have to add new rows for every URL you want to canonicalize to a different URL. 

{% liquid
    assign url = canonical_url
    case url
        when 'https://www.vietri.com/collections/sets/dinnerware-set'
            assign url = 'https://www.vietri.com/collections/dinner-place-settings'
        when 'https://www.vietri.com/collections/sets/bakeware-set'
            assign url = 'https://www.vietri.com/collections/bakeware-sets'
    endcase
%}

<link rel="canonical" href="{{ url }}" />

 

ttbinfo
Excursionist
16 0 1

Wow thank you, definitely going to give that a try. Do you mind telling me where I would input the snippet?

baileywitt3
Shopify Partner
3 0 1

Yes, sorry I'm not the developer, just the "messenger".

 

We put this code up in the <head> section of theme.liquid, where 'canonical-helper' is the name of the snippet file. (canonical-helper.liquid)

 

{% render 'canonical-helper' %}

 

 

So you create the snippet file in the Snippets folder, then reference that file in the theme.liquid.

ttbinfo
Excursionist
16 0 1

Nice one, thanks so much and all the best to you!

Annuksun
Tourist
15 0 1

Hi All, 

 

I would be grateful if you could help with setting up a redirect for the query page. 

Essentially, product pages contain a link to Vendor name but when I click it it takes me to query string. I'm trying to set a redirect from the query URL to a proper collection for that brand.

For example:

URL that ends with /collections/vendors?q=Agent%20Nateur should be redirected to /collections/agent-nateur.

However, I'm facing two issues here.

1. For simple brands like for example "Venn" redirect simply does not work and I don't understand why. Feel like query string cannot be redirected but I haven't found any information about it on the net.

2. For multi-word Vendor name like the example (Agent%20Nateur) above, when I'm saving redirect %20 in the URL is being replace with "+" so obviously /collections/vendors?q=Agent%20Nateur and /collections/vendors?q=Agent+Nateur are not the same and redirect does not work either.

 

Any thoughts on this? I'm kind of stuck.

Thanks

Serje 

Hallway
Shopify Partner
27 3 9

As you've discovered, you're limited in what you can do with server side redirects on Shopify.

 

Google's Search Central documentation mentions that you can add meta refresh redirects when you can't do server side redirects. Server side redirects are what happen when you add redirects into the Shopify admin.

 

Meta refresh redirects are more within your control, since you can define them in the source code of your theme as a HTML tag.

 

From Google:

If server-side redirects aren't possible to implement on your platform, meta refresh redirects may be a viable alternative. Google differentiates between two kinds of meta refresh redirects:

  • Instant meta refresh redirect: Triggers as soon as the page is loaded in a browser. Google Search interprets instant meta refresh redirects as permanent redirects.
  • Delayed meta refresh redirect: Triggers only after an arbitrary number of seconds set by the site owner. Google Search interprets delayed meta refresh redirects as temporary redirects.

https://developers.google.com/search/docs/crawling-indexing/301-redirects#metarefresh

 

You'll be able to write some custom Liquid into which adds a meta refresh tag when the URL being visited is one that you would like to redirect.

 

Some example Liquid code which would redirect a tagged collection URL:

 

 

{% liquid
  case request.path
    when '/collections/my-collection/my-tag'
      assign redirect_url = collections['my-other-collection'].url
  endcase
%}
{% if redirect_url != blank %}
  <meta http-equiv="refresh" content="0; url={{ redirect_url }}">
{% endif %}

 

 

You would need to insert this just after the <head> tag in theme.liquid, and customise the snippet to redirect based on the URLs you want to target, and what collection to redirect them to. Bear in mind if you are using subfolders in Markets, then you may need to account for that as well.

Matthew Hall - Founder @ Hallway
Shopify design, build, optimisation, support & consultancy
→ Was my reply helpful? Click Like to let me know!
→ Did I solve your question? Mark it as an Accepted Solution!
Annuksun
Tourist
15 0 1

Hi Hallway,

 

Is there any chance you can help with a similar issue? We are trying to redirect from URLs that have multiple slashes at the end. 

We tried the following code in the head of the page but for some reason, a redirect is not working.  Not sure what we are doing wrong. 

{% assign current_path = request.path %}
{% assign normalized_path = current_path | replace: '//', '/' %}
{% assign normalized_path = normalized_path | replace: '/+', '/' %}
{% if current_path != normalized_path %}
<meta http-equiv="refresh" content="0; url={{ normalized_path }}{{ request.url | split: '?' | last }}">
{% endif %}

 

any thoughts?

Thanks

Hallway
Shopify Partner
27 3 9

Can you provide examples of the URLs that are being used to access the page where this Liquid is being executed?

Matthew Hall - Founder @ Hallway
Shopify design, build, optimisation, support & consultancy
→ Was my reply helpful? Click Like to let me know!
→ Did I solve your question? Mark it as an Accepted Solution!