Score:0

Broken non english url on redirect in Nginx

in flag

I am running WordPress on the NginX server.

And I have a problem with permalink getting the query string ?nonamp=1.

So I want to redirect like this:

example.com/abc/?nonamp=1/ redirect to example.com/abc/

The code below I found works fine.

if ($arg_nonamp) {
    return 301 $uri;
}
if ($query_string ~ "^(.*)nonamp(.*)$") {
        rewrite ^(.*)$ $uri? permanent;
}

However, the problem is that if the web page address contains a non-english character, it is converted and redirected as follows.

다ë‚%C2%AD-여행-다ë‚%C2%AD-대성당/

I already set the string in nginx to utf8, but it doesn't work.

charset utf-8;
server {
      charset utf-8;
      }

Please let me know how do i solve this issue. I am using Korean for permalink.

Thank you

Richard Smith avatar
jp flag
I cannot reproduce this problem. Both forms in your question appear to redirect URLs containing non-English characters correctly.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.