I am using following functions to display pagination on archive pages of my site.

<?php previous_posts_link('< Previous', $loop->max_num_pages); ?>
<?php next_posts_link('More >', $loop->max_num_pages); ?>

And it is working very fine on my localhost. But not on my server, the issue is that we have some redirects written on my server's .htaccess and since my wordpress is subdomain I dont really want to touch my root .htaccess file.

Default pagination links my pages to


and so on.. but the above links gets redirected to something like following


which eventually returns 404 page. (ofcourse its due to .htaccess redirects on my server)

So All I want to do is change permalink structure for my pagination so that my pagination links look something like these :


Thank You.

1 Answer 1


You could filter get_pagenum_link. The parameter has to be paged, not page then.

add_filter( 'get_pagenum_link', 'wpse_78546_pagenum_link' );

function wpse_78546_pagenum_link( $link )
    return preg_replace( '~/page/(\d+)/?~', '?paged=\1', $link );

But I would rather try to fix the broken rewrite rules.

  • Thanks for your reply Toscho I'll give it a try. Just curious to know why cant i use page as parameter is that keyword reserved by wordpress? Commented Jan 7, 2013 at 12:14
  • @KuldeepDaftary page is for paged posts (one post split into multiple pages), paged is for paged archives, lists of posts.
    – fuxia
    Commented Jan 7, 2013 at 12:16
  • Well it works! Thanks. Though as you suggested I asked server guy to change the redirect settings and ignore redirects for my wordpress directory. Thanks once again :) Commented Jan 7, 2013 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.