We have our blog posts on a custom page with a custom pagination. For example a blog post name is url.de/postname instead of url.de/blog/postname.
Therefore we have a page /blog/ which has the pagination on it. The links from the pagination module like /blog/2/ lead to a 404 error page, because the /page/ part is missing.
I cannot edit the page urls - therefore i would like to use a redirect rule for this.
What i got till now:
function my_pagination_rewrite() {
add_rewrite_rule( '(([^/]+/)*blog)/?([0-9]{1,})/?$', 'index.php?pagename=$matches[1]&paged=$matches[3]', 'top' );
}
add_action( 'init', 'my_pagination_rewrite' );
But this leads to /blog/2/page/2 --> 404.
How can i get this code to return /blog/page/2 or just return /blog/2/ (and show the content of /blog/page/2)
Thanks for help!