Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to redirect requests from a umlaut domain to another domain.

My following code works with ANY other domain, but not umlaut:

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^(www\.)?frankfurter-flöhe\.de/$ [NC]
  RewriteRule ^ http://kinderkultur-frankfurt.de/frankfurter-floehe-theaterprogramm.html [R=301,L]
</IfModule>

However, when I call the umlaut domain and then copy it from Google Chrome's address bar, I get this:

http://xn--frankfurter-flhe-zwb.de/

Although, if I use that obfuscated domain in my htaccess file instead of the "real" umlaut domain, it doesn't work either.

Does anybody have an idea how to match that domain?

share|improve this question

migrated from stackoverflow.com Oct 4 '12 at 13:36

This question came from our site for professional and enthusiast programmers.

    
"that obfuscated domain" is in Punycode and is how internationalised domains are stored in DNS. – w3d Mar 8 at 9:03

Did you try with :

RewriteEngine On
RewriteCond %{HTTP_HOST} ^frankfurter-flöhe.de$ [OR]
RewriteCond %{HTTP_HOST} ^www.frankfurter-flöhe.de$
RewriteRule (.*)$ http://kinderkultur-frankfurt.de/frankfurter-floehe-theaterprogramm.html [R=301,L]
share|improve this answer
1  
You simply split up my condition into two conditions. My condition works perfectly well with other domain names but not with the umlaut domain. Splitting it up makes no difference. – Christian Engel Oct 4 '12 at 10:09
    
Yes but I want to check if when splitting your conditions, it solves the problem, because redirection on frankfurter-flöhe.de works, but not www.frankfurter-flöhe.de redirection – Laurent Brieu Oct 4 '12 at 10:18
    
Nope, it does not work. – Christian Engel Oct 4 '12 at 13:15

Try using the NE flag, to prevent mod_rewrite from encoding the URL. For more information about NE: http://httpd.apache.org/docs/current/rewrite/flags.html#flag_ne

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^(www\.)?frankfurter-flöhe\.de/$ [NC,NE]
  RewriteRule ^ http://kinderkultur-frankfurt.de/frankfurter-floehe-theaterprogramm.html [R=301,L]
</IfModule>

If this doesn't work, try to use the HEX equivalent of umlaut, as suggested in: Umlauts in htaccess redirects

share|improve this answer
    
I tried this already (as mentioned above) and it doesn't work. – Christian Engel Oct 4 '12 at 10:09
    
I updated my answer to use the NE flag instead. – Kao Oct 4 '12 at 10:31
    
The NE flag results in an error 500 – Christian Engel Oct 4 '12 at 13:10
    
Did you add the space after NC, NE? That might cause the 500 error. I removed it from the answer. It might also be [NC] [NE] - Not really sure. I will run some tests later if you don't get it working. – Kao Oct 4 '12 at 13:22
    
The error appears with and without the space, as well as when only the NE flag is used. – Christian Engel Oct 4 '12 at 13:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.