Hello,
We apologize for the issue you are facing with the pagination on your blog posts. It sounds like you want to redirect the second page of your posts to the first page, and while you’ve set the canonical URL, it seems that it’s not functioning as expected for some posts.
To achieve the redirection from www.domain.com/blog-name/page/2/
to www.domain.com/blog-name/
, you can create a custom redirection in Rank Math. Here’s how you can do it:
- Go to Rank Math Dashboard: Navigate to your WordPress dashboard and then to Rank Math SEO > Redirections.
- Add New Redirection: Click on Add New.
- Set Up the Redirection:
- In the Source URL, enter
/blog-name/page/2/
.
- In the Destination URL, enter
/blog-name/
.
- Choose the type of redirection as 301 Permanent.
- Save Changes: Make sure to save your changes.
If you have multiple posts that require this redirection, you may need to repeat this process for each one or use a regex pattern if they follow a similar structure.
Additionally, ensure that there are no conflicting redirects or caching issues that might be affecting how these URLs are processed. You can also check if there are any plugins that might be interfering with the redirection process.
If the problem persists after trying these steps, please reply to this ticket, and a human agent from the Rank Math Support team will assist you further.
Thank you for raising this concern!
Is not only for /page/2, but any page number
Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. We’re sorry for any inconvenience this issue may have caused you.
Rank Math adds a self-referencing canonical URL by default for your paginated pages.
However, if it is not working on your site, then you can try the following filter to force the self-referencing canonical URL of your blog pagination:
add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
global $wp;
$current_slug = home_url( $wp->request );
if ( is_paged()) {
$canonical = $current_slug . '/';
}
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/
For the redirect, you can use the following rule:
Source: blog-name/page/(.*)
Type: Regex
Destination: /blog-name
Hope that helps.
Thank you.
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.