Search form redirect to home page after you search with Cyrillic letters only

Viewed 51

I have strange behavior in search functionality in WordPress. I have a problem with search in this website. When i search with Latin letters (Stefan Kosanović), it's perfect, but when i search with Cyrillic letters (Стефан Косановић), it keeps redirect me on homepage. Locally, everything is working fine, and local version is 1:1 with live version, so in files there is no difference. Also PHP and WP versions are the same.

Far as i saw, if you search with Cyrillic letters, URL is not passing URL decode.So for example, space is not replaced with + symbol, etc.

Is it possible that hosting settings restrict some functionality?

1 Answers

If you copy and paste the url to IDE you will see something like

https://fakenews.rs/?s=%D0%A1%D1%82%D0%B5%D1%84%D0%B0%D0%BD%20%D0%9A%D0%BE%D1%81%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D1%9B"

paste that to urldecode

echo urldecode ( "https://fakenews.rs/?s=%D0%A1%D1%82%D0%B5%D1%84%D0%B0%D0%BD%20%D0%9A%D0%BE%D1%81%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D1%9B" );

and you will see: https://fakenews.rs/?s=Стефан Косановић and that is the expected output from the url.. To solve the problem, what you can try is to decode the url and paste it as a string to the search query or try and convert letters to latin and paste to the query

Related