I seemingly to have a strange issue I have found in almost every other WordPress site.
Suppose, you have set your Blog home to a static WP page /myhome
. And you have a separate page for blog /blog
.
Now, this works fine and should be:
/blog
/blog/page/2
/blog/page/3
/blog/page/4
But, for all other pages, e.g. /about-us
, these links also work:
/about-us/page/2
/about-us/page/3
/about-us/page/4
And show the content of the /about-us
page.
My problem is that /about-us/page/2
should ideally redirect to /about-us
(it’s canonical URL) since there are no paginations in any other page except the /blog
.
What am I missing there ? This seems to happen on almost all sites I have checked and is really frustrating from SEO point of view.
This is by design and intentional. WordPress rewrites have become increasingly complex over the years, and many plugins utilise the
page
endpoint for a page (usually with a template and custom query) – redirecting introduces a potential world of pain.Long story short, it doesn’t matter anyway. WordPress adds
<link rel="canonical />
for pages, so no need to worry over duplicate content.Update: For localised situations where you want to disregard the potential risks, this will canonicalize all page URLs – note that it does not check if a page is actually paginated (i.e. with the
<!--nextpage-->
quicktag) and will break this feature if you use it.This is not the normal Worpdress behaviour, if pagination isn’t enabled for a page it shouldn’t accept the page argument. Just tested on a WordPress page,
/mypage/page/2
gives a 404.It probably have something to do with your theme and how the post are queried. For example. Look for
posts_per_page
andnumberposts
in your theme files, and locate the query that is related to your page. Change then the value to-1
in order to disable the pagination.One other solution would be redirect all paginated URLs (except for blog) – this goes in functions.php: