.htaccess redirect umlaut domain

.htaccessapache-2.2idnredirect

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?

Best Answer

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: https://stackoverflow.com/questions/11107375/umlauts-in-htaccess-redirects

Related Topic