We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Canonical Tags Not Matching RedirectsRSS

5 replies

Last post May 14, 2021 07:19 AM by samwu

  • Canonical Tags Not Matching Redirects

    May 11, 2021 02:49 PM|bmcintyre1|LINK

    Hello All,

    First time here, thanks for having me.  I hope this is in the correct section.  Please correct me if not.

    I have a question.  I set up a redirect for eliminating and redirecting upper case and to lower case and adding a forward trailing slash for SEO purposes.  This worked on most products, I had to go in and manually edit some, not perfect but it is working much better.

    Here is my question.  The redirect is properly redirecting most for example, https://domain.com/products/p/example-product/ from other upper case and non-trailing slash iterations.  BUT, the issue I have having is that the canonical tag on the page has the old URL. 

    So on the page seen above, https://domain.com/products/p/example-product/, redirects fine from say, https://domain.com/products/p/Example-Product, correctly.  But the page still carries the tag, <link id="CanonicalLink" rel="canonical" href="https://domain.com/products/p/Example-Product"></link>.  It is causing some site audit issues.

    I checked around and could not find my answer.

    Any ideas on how to fix this?  Any help is appreciated.

    Thanks!

  • Re: Canonical Tags Not Matching Redirects

    May 12, 2021 07:45 AM|samwu|LINK

    Hi bmcintyre1,

    bmcintyre1

    But the page still carries the tag, <link id="CanonicalLink" rel="canonical" href="https://domain.com/products/p/Example-Product"></link>.  It is causing some site audit issues.

    According to your description, I couldn’t understand your requirement clearly.

    Do you want to change the link in the page content through url rewriting? If so, then you need to use the outbound rule.

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-outbound-rules-for-url-rewrite-module

    If I misunderstand your requirement, please post more details information about your requirement.

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Canonical Tags Not Matching Redirects

    May 12, 2021 12:14 PM|bmcintyre1|LINK

    Hello,

    Thanks for the reply.  Let me clarify.  Sorry if I was not clear.

    The redirect is working.  For the most part.  So any upper case or NON trailing slash populates the URL, that is fine.

    My issue is that in the backend, the canonical tag does not match the URL that it was redirected to.  

    So I theory in stead of the "old" url being displayed the canonical tag should be, <link id="CanonicalLink" rel="canonical" https://domain.com/products/p/example-product/></link>

    I hope I explained that properly.  The URL redirects are working fine, the canonical link tag is not correct.

    Any advise?

    Thanks

  • Re: Canonical Tags Not Matching Redirects

    May 13, 2021 08:33 AM|samwu|LINK

    Hi bmcintyre1,

    bmcintyre1

    So I theory in stead of the "old" url being displayed the canonical tag should be, <link id="CanonicalLink" rel="canonical" https://domain.com/products/p/example-product/></link>

    Your problem is in the backend, but url rewrite is to modify the url. what is your project? Have you posted to iis? Can you post a screenshot of the problem?

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Canonical Tags Not Matching Redirects

    May 13, 2021 12:26 PM|bmcintyre1|LINK

    Hello!

    Thanks for your reply.  Please see attached.  You will see the URL that I am viewing the source on (yellow line below each URL) and also the URL that is being populated for the canonical tag.  They do not match.

    I got it on the URL rewrites, but how do we make sure the URL matches the canonical tag?

    Thoughts?

    Thanks

  • Re: Canonical Tags Not Matching Redirects

    May 14, 2021 07:19 AM|samwu|LINK

    Hi bmcintyre1,

    bmcintyre1

    Thanks for your reply.  Please see attached.  You will see the URL that I am viewing the source on (yellow line below each URL) and also the URL that is being populated for the canonical tag.  They do not match.

    I got it on the URL rewrites, but how do we make sure the URL matches the canonical tag?

    This is an html page, if you want to change the content of the link, you still need to use the outbound rewrite rule I mentioned above.

    Create an outbound rewrite rule.

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >