Pagination - how to make pretty urls?

Hi all,

So, with my standard wp setup, using pretty urls, my paginated links for ‘more’ items on the home and archive pages have the urls like /page/1/ , /page/2/, /page/3/…

If I use GenerateBlocks pagination, they are like /?query-7edb629a-page=2, /?query-7edb629a-page=3…

I hate that. Both from a pretty standpoint, but also that Google has all of my /page/2/ type links indexed and crawls them regularly and I’m breaking them by using GenerateBlocks.

I contacted GenerateBlocks support, they said the solution is to not use GenerateBlocks. But I have reason to use GenerateBlocks, which is why I got it.

It seems like there should be a solution to this. I would expect it would be a pretty big issue for many sites.

I hate to make my site any more complex than it is, but maybe something in htaccess that would display the /?query-7edb629a-page=2 page when the entered url is /page/2/ ?

Then I would also need to do something so that the incrementing anchor link in GenerateBlocks is formatted as /page/2/

Thoughts on this and coding examples would be appreciated!


1 Like

Okay, I can use htaccess to rewrite the urls so that I can use /page/2/, /page/3/, /page/4/… and get the GenerateBlocks pagination results using this in htaccess:

RewriteRule ^page/([^/]*)/$ /?query-7edb629a-page=$1 [L]

Now though, I have to get GenerateBlocks to use /page/2/, /page/3/, /page/4/… as the links in the box under the results.

Is there some way to do this using a function in functions.php?