-
How can I canonical pagination to the first page of paginition?
I know it is done through the settings of each page, but I want a solution for the whole site
-
Hello, I’m sorry to hear that you’re facing issues with canonical pagination. To set the canonical URL for pagination across your entire site, you can use Rank Math’s advanced settings.
Here’s how you can do it:
-
Go to your WordPress Dashboard and navigate to Rank Math SEO.
-
Click on the Advanced Mode to enable advanced settings if you haven’t already done so. You can find this option under WordPress Dashboard → Rank Math SEO. If you cannot find the Advanced tab, please enable the Advanced Mode.
-
Once in the Advanced Mode, go to the Advanced tab when editing a post or page.
-
Under Advanced Settings, you will see a Canonical URL field where you can add the URL of the first page of pagination.
-
Save or update your post or page.
By setting the canonical URL for pagination to the first page across your entire site, Google will then re-index the pages with the new canonical URL.
If you have any further questions or need additional assistance, please feel free to reach out to our support team. We’re here to help!
Sources:
How to Fix ‘Duplicate, Submitted URL Not Selected as Canonical’ Issue in Google Search Console » Rank Math
Setting Canonical URLs in Rank Math » Rank Math
Advanced Tab in Rank Math SEO’s Meta Box
Alternate Page with Proper Canonical Tag Status in Google Search Console » Rank MathHello,
Thank you for contacting us and sorry for any inconvenience that might have been caused due to this issue.
If you want to set the canonical URL for paginated content to the first page, you can use the following filter:
add_filter( 'rank_math/frontend/canonical', function( $canonical ) { $current_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Check if the URL contains '/page/' and is not the first page if ( false !== strpos( $current_url, '/page/' ) && ! is_paged() ) { $canonical = strtok( $current_url, '?' ); // Set canonical to the first page } return $canonical; });
And here’s a guide on how you can add a filter to your website:
https://rankmath.com/kb/filters-hooks-api-developer/Let us know how this goes. Please let us know if you have further questions or concerns.
Thank you.
I tested the code, cleared the cache, but it didn’t work
I tested it on a category page with a link similar to this:
site.com/c/phone/page/3
And not canonicalized to the first page:
site.com/c/phone/Hello,
Could you please share the exact code you have added so we can check?
Meanwhile, please try using this code instead to set the canonical URL as the URL of the main/first page:
add_filter( 'rank_math/frontend/canonical', function( $canonical ) { if ( is_paged() ) { $link = $_SERVER['REQUEST_URI']; $arr = explode('/page/', $link,); $canonical = home_url($arr[0]. '/'); } return $canonical; });
Let us know how this goes.
Of course, if it was a wp page, it would still be impossible to do it through page settings.
Hello,
In this case we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.
Without access, There is no normal solution to disable the pagination tag on the home page?
Hello,
We requested access to your website to fully debug this issue further since the solution provided earlier didn’t work.
There must be a reason the solution we provided earlier did not work, and that is what we need to discover so that we can proffer the right solution.
However, if you are unable to share your website admin for us to troubleshoot further, are you able to create a staging website on your end?
If you can, please create one, reproduce the error there, and share the login access here, this will allow us to deeply investigate the issue and resolve it permanently without worrying about touching your live website.
You may also follow this article to create the staging website: https://www.wpbeginner.com/wp-tutorials/how-to-create-staging-environment-for-a-wordpress-site/
We really look forward to hearing back from you.
Thank you.
Oh, there’s a misunderstanding, I’ll open a new ticket
Hello,
We are glad to know that this issue has been resolved. Thank you for letting us know.
This ticket will be closed now, but you can always open a new one if you have any other questions or concerns. We are here to help you with anything related to Rank Math.
We appreciate your patience and cooperation throughout this process.
Thank you for choosing Rank Math.
-
The ticket ‘pagination canonical’ is closed to new replies.