I have a website with cyrillic domain name. There is an authorization lib which redirects the user to login page, but the url is somehow missformed.
The website is on CodeIgniter and the redirect function used is the standard redirect function of the codeigniter. I have modified a bit and it looks now like this
function redirect($uri = '', $method = 'location', $http_response_code = 302)
{
if ( ! preg_match('#^https?://#ui', $uri))
{
$uri = site_url($uri);
}
//exit(idn_to_ascii($uri));
switch($method)
{
case 'refresh' : header("Refresh:0;url=http://".idn_to_ascii($uri));
break;
default : header("Location:http://".idn_to_ascii($uri), TRUE, $http_response_code);
break;
}
exit;
}
idn_to_ascii functions seems not rightly coding the UTF url string ...
Can anybody hint a solution?
Instead of
http://xn-------63dat7alb0aizbbjcoujt7j3a6e.xn--p1ai/auth/admin/
I get
xn-------63dat7alb0aizbbjcoujt7j3a6e.xn--/auth/login-foj4c
Any ideas ?