URL rewriting: possible error where + is replaced by% 20 in the query string

I discovered a very strange behavior of WP that is present even in a fully inventory facility.

I even set up a test site for the purpose of this question.

Therefore, suppose there is a page where there are some query strings with several terms separated by +, such as mywordpress.com/sample-page/?param=val1+val2

Now, suppose this page shows results that span several pages, and go to page 2. Strangely, the link becomes wordpress.com/sample-page/page/2/?param=val1%20val2

Basically, I discovered that / page / is not even necessary for this strange rewrite / replacement. All that is needed is / 2 /, or in general a / d / where d is a decimal number, part so that + is replaced by% 20.

Even more strange, when the parameter is the action "s" used for the default search box, + it is not replaced by% 20.

As I said, for the purpose of this question, I set up a totally stock WP site for you to see this in action.

So, if you go here: https://www.ibizaclub.gr/test/?s=test+page, you will see the results returned from the terms "test page" (I created 20 of them). So the results span several pages.

Now, if you click on page 2, you will be moved to the URL https://www.ibizaclub.gr/test/page/2/?s=test+page. This is perfectly fine up to here.

However, if you change the "s" parameter to something else for the needs of other custom functionality, when you go to / page / 2 / there will be a rewrite that will take place. Study the following URLs on my test site. They do not do anything specific, but they will see the redirection in action:



Do you see what is happening? The second URL when it is loaded replaces the + with a% 20 if it is in Chrome, and with a blank space when it is in any other browser …

Any idea why this is happening? Does it work for some particular functionality or is it just a well-hidden error? Oddly enough, even with the replacement that is taking place, my addon still recognizes all the terms that have been passed in the query string, so nothing is broken. It just ruins the uniformity of URLs, and it's driving me crazy …