Wordpress error on saving administration settings with IDN domains

552 views Asked by At

I have created a new wordpress site on Azure Web Sites, this time using IDN Domain. I configured the domain in the administrator page using its punycode representation:

Wordpress URL: http://xn--sandraeiaki-8db.com Site URL: http://xn--sandraeiaki-8db.com

Everything works fine, except saving settings from the worpress settings page inside the administration. After successfully saving settings wordpress tries to redirect back to the settings page, however somehow that redirect changes the domain, instead of redirecting back to http://xn--sandraeiaki-8db.com it redirects to http://xn--sandraeiaki-bra36d.com/

The only clue I got is that, http://xn--sandraeiaki-bra36d.com/ is the punycode representation of http://sandraeiã±aki.com/, so it seems like wordpress is using an invalid encoding here instead of UTF-8 for redirecting back to the settings page.

Update

I can see in wordpress options.php file that it tries to redirect using, after succesfully saving changes:

/**
* Redirect back to the settings page that was submitted
*/
$goback = add_query_arg( 'settings-updated', 'true',  wp_get_referer() );
wp_redirect( $goback );
exit;

Update 2 After a chat session with soulseekah we have traced back the issue to be in the location value set by IIS on Azure, creating a simple php page, that changes the location header, the redirection fails:

<?php header( 'Location: /' ); exit; ?>

Examining the location header value, shows that it is encoded in ASCII instead of UTF-8:

Location: sandraeiñaki.com

Update 3

After some testing it only happens when the header() php function is passed a relative location url value, setting the location value to an absolute uri resolves without problems , either by using the punycode domain encoding or utf-8 encoding.

I made a temporaly fix by changing wordpress redirect function, now it sets only absolute uris, and seems to be working.

However, how I can fix that behaviour permanently?

0

There are 0 answers