IDN and HTTP_HOST

Posted by Sandman on Server Fault See other posts from Server Fault or by Sandman
Published on 2010-02-11T19:26:49Z Indexed on 2010/03/23 10:03 UTC
Read the original article Hit count: 547

Filed under:
|
|
|

So, when I want to link my users to a specific page I always use (in php): "http://" . $_SERVER["HTTP_HOST"] . "/page.php", to be sure that the link points to the page they're currently surfing (and not one of the server aliases).

But with IDN names, HTTP_HOST is set to "xn--hemmabst-5za.net" (for example) - which of course works but doesn't look very nice. Is there a way to have HTTP_HOST set to the correct IDN name in these cases (in this case - "hemmabäst.net")?

I rather do it in Apache before it comes to PHP, because otherwise I'd have to replace all my usage of $_SERVER["HTTP_HOST"].

Any ideas?

© Server Fault or respective owner

Related posts about httpd

Related posts about apache