Canonical url help

#594071
  • Resolved Anime PerTutti
    Rank Math free

    Hi 2 questions, before asking here I asked ”chatgpt” because on google I couldn’t find answers and now I have two questions.
    I never touched canonical urls and always left to do to rank math but this thing now that I had to change domain extension for some problems, only here I have two problems.
    The search console gives me as duplicate links still all the ones from the old site for probably problem with the canonical urls since the 301 redirect did it right, never having changed them.
    1 how do I tell rank match to put all the canonical urls that are the page in question without changing them one by one?
    2 is it possible that from now on it will put exactly the page and article when they are created automatically?
    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.

    I’m not sure if I properly understood your concern. But assuming you had xyz.com domain earlier and now you moved your site to xyz.org. And all the posts/pages canonical are currently pointing to xyz.com instead of xyz.org. Hence you want to set canonical for xyz.org to all your posts/pages.

    if that’s the case, then the following filter to help you to set the current URL as your canonical:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    	$canonical= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	return $canonical;
    });

    Here’s how you can add filters/hooks to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hi, sorry if I expressed myself wrong, I try to rewrite better I am using deppl to translate as I don’t know English so well.

    I changed domain extension exactly as you said, with rankmath I never changed the canonical url from each page and each post and in fact if I go to see some pages there it is empty and it marks as transparent the slug url of the page/post but technically for google it is not ok as I did not put anything.
    After the domain extension change on search console, after doing the transfer from and sending them the sitemap after a few days I got in the unindexed pages section more than 3/4 of the pages and posts not indexed because as canonical url the old domain, I also did a validation request but not passed it exactly today.

    So with your guide you sent me I should solve this problem for all pages/posts both past and future ones?
    And if by chance I change the slug is the new one automatically put in?
    One last thing, in the guide you sent me do I have to follow all the points from 1 to 3.2 or are some of them optional? Because from what I understand I could start from 2 and finish at 3.2 or vice versa start from 1 and then go over 2.
    Thank you

    Hello,

    Thank you for the additional explanation.

    Yes, from what we understand from your message – the filter should help resolve this. Although, you might also be able to resolve this by editing the affected pages and making sure the canonical field is empty then saving the page – this should update the canonical URL to the current page URL.

    That said, you might want to send us screenshots of the error you got from your search console as well as the validation request you didn’t pass. This would help us understand the issue better. You can use imgur.com/upload to upload your screenshots, then share the URL with us here.

    And if by chance I change the slug is the new one automatically put in?

    Yes, if you update the affected post, even without changing anything – the canonical URL should update. Try it and let us know if it is updated. You can see your current canonical URL by clearing your cache and visiting view-source:https://xyz.org/post-url then searching for rel="canonical".

    in the guide you sent me do I have to follow all the points from 1 to 3.2 or are some of them optional

    The guide we shared explains different ways to add the code to your site. For example, if you want to use the Code Snippet plugin to add the code to your site, you can follow options 1.1 – 1.6, 1.7 is for removing the code. Likewise, if you want to add the code to your site by creating the rank-math.php file – you’ll need to follow the instructions from 2.1 to 2.4. 3.1 & 3.2 are for adding the code to your theme’s functions.php file – which we don’t recommend.

    I hope this helps you understand and resolve the issue. Let us know if you need help with anything else.

    Thank you for choosing Rank Math!

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    I have about 1100 pages in the sitemap and those now every 4/5 days I keep doing the validation but it always sees the old links, however it seems to drop every now and then.
    I checked almost all the links report them and in canonical url the text is transparent and you can see it is correct, I don’t know what to do anymore, should I just wait?
    Because this problem made me lose practically all positions on google, I went from 44500 visits to 7690 weekly 🙁

    Hello,

    Rank Math automatically adds a self-referencing canonical URL if your posts and pages are set to index.

    Could you please share the screenshot of the old links in the report so we can check their canonical URL?

    Looking forward to helping you.

    Thank you.

    Do you mean page links or other links?

    Hello,

    Thank you for your reply.

    We are sorry to hear that you are still facing issues with the canonical URLs and the Google validation. We would like to help you resolve this as soon as possible.

    We mean the old links that you mentioned in your previous message, the ones that Google still sees in your sitemap. Could you please share a screenshot of those links in the Google Search Console report? This will help us check their canonical URLs and see if there is any problem with them.

    Also, where possible please share the screenshots in English. You can add &hl=en to your search console URL to get the page served in English.

    We appreciate your cooperation and patience. We hope to hear from you soon.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘Canonical url help’ is closed to new replies.