Support » Fixing WordPress » Thrown to wp-admin.php after entering a comment when using IDN

  • My blog has an international domain name containing the letter ö. When I have both “WordPress Address (URL)” and “Site Address (URL)” set to vilmoskö (as it should be) a nasty problem appears after entering a comment to a post: the user entering the comment is sent to …/wp-admin/ and confronted with a login-screen instead of remaining on the post and seeing the freshly entered comment comment. This happens also when I disable all plugins.

    I can fix this problem by changing the “Site Address (URL)” to the punycode version of the IDN, i.e. “”. Then the user remains on the post after entering the comment (the desired behavior). This is my current setting.

    However, this rises other problems as many (but not all!) references in the html Head and Body to my blog then are issued with the punycode variant of the URLs, e.g.

    <meta name="description" content="Was uns in diesen Tagen fehlt, ist eine Abkühlung. Vielleicht in Apulien, in Santo Spirito bei Bari?"/>
    <link rel="canonical" href="" />
    <meta property="og:locale" content="de_DE" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="Was uns an diesen Tagen fehlt … | Vilmoskörtes Blog" />
    <meta property="og:description" content="Was uns in diesen Tagen fehlt, ist eine Abkühlung. Vielleicht in Apulien, in Santo Spirito bei Bari?" />
    <meta property="og:image:secure_url" content="https://vilmoskö" />
    <meta name="twitter:image" content="https://vilmoskö" />
    <link rel='shortlink' href='' />
    <link rel="alternate" type="application/json+oembed" href="" />
    <link rel="alternate" type="text/xml+oembed" href="" />

    Somehow it is a bit inconsistent. What can I do?

    • This topic was modified 6 months, 1 week ago by  vilmoskoerte.
    • This topic was modified 6 months, 1 week ago by  vilmoskoerte.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    When I have both “WordPress Address (URL)” and “Site Address (URL)” set to vilmoskö (as it should be)

    Actually, I think it’s the other way around. I’m not 100% on how IDNA works, but I think that both of those should be set to your xn-punycode name.

    The domain name is really that xn-thing. That’s what’s in the DNS, that’s what the server knows about, etc. Everything in the HTML should be pointing to that. The Unicode version with the ö in it is just how browsers render the domain name.

    See, domain names are originally based in ASCII characters. They simply can’t have characters like that in them. So, the International Domain system was made to address that problem, but it’s still built on top of the original design.

    So, if you want consistency, then the consistent and arguably correct way to do it is to put the xn name in both places, and have it in the HTML source. The browsers handle the conversion and display of the domain name to the proper character set for you.

    “Everything in the HTML should be pointing to that”: I’m not so sure, the idea is of course that you can use the non-punycode version everywhere (this is friendly towards humans, whereas the punycode version is disgusting for humans). Only when asking the DNS browsers should convert to the punycode version.

    Also note that when I use the non-punycode version for both variables, everything continues to work fine, except for the comment issue, which is the real problem to be solved.

    The only effect I see when setting both variables to the punycode name is that ALL links in the posts now use the punycode version, which is just the opposite of what I want.

    I think there still is some shortcoming in the WordPress code handling IDN when commenting. I am not good at PHP and have no understanding of how the WordPress code is organized (it seems to be rather complex, though), so I was not able until now to locate the code where the comment handling resides.

    • This reply was modified 6 months, 1 week ago by  vilmoskoerte.
    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    The comment issue sounds like that your server doesn’t know about your IDN, only about the punycode version of it. If it’s redirecting, then something is redirecting you there. Maybe it’s the htaccess, maybe it’s the server config itself. You need to solve that at the server level, because it’s probably not WordPress doing that redirection.



    Thanks, I’ll make some investigation there.

    My htaccess file only contains what the WordPress installation added there:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    It is possible that WordPress is redirecting you there because the server is sending it the request with the real domain name of while you have configured WordPress to expect it to be vilmoskö WordPress doesn’t know how to translate from one to the other, so it sees that you’re requesting on the wrong URL, and thus redirects you to what it thinks is the correct one.

    In which case, add some code to the wp-config file to fix the value in the $_SERVER variable to have the corrected domain name.



    I added

    $_SERVER['SERVER_NAME'] = '';

    to the wp-config file to no avail 🙁



    I also tried to make wp_safe_redirect() feel happy (according to by adding the following code to the files functions.php of my theme:

    add_filter( 'allowed_redirect_hosts' , 'my_allowed_redirect_hosts' , 10 );
    function my_allowed_redirect_hosts($content){
    	$content[] = utf8_encode('vilmoskö');
     	$content[] = '';
    	return $content;

    but also that did not help (I tried with and without utf8_encode()).


    I’m experiencing the same problem. I can’t imagine no one other there has fixed this yet, but I’m having a hard time finding a solution…

    Have you made any progress, @vilmoskoerte ?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.