4

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?

1
  • 1
    "that obfuscated domain" is in Punycode and is how internationalised domains are stored in DNS.
    – MrWhite
    Mar 8, 2016 at 9:03

3 Answers 3

1

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

7
  • I tried this already (as mentioned above) and it doesn't work.
    – Christian Engel
    Oct 4, 2012 at 10:09
  • I updated my answer to use the NE flag instead.
    – Kao
    Oct 4, 2012 at 10:31
  • The NE flag results in an error 500
    – Christian Engel
    Oct 4, 2012 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, 2012 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, 2012 at 13:30
0

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]
3
  • 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, 2012 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, 2012 at 10:18
  • Nope, it does not work.
    – Christian Engel
    Oct 4, 2012 at 13:15
0

The UTF-8 URL with Umlaut needs to be converted into ACE encoding (ASCII Compatible Encoding).

You can use the following online tool to convert an international domain with Umlauts.

www.frankfurter-flöhe.de becomes xn--frankfurter-flhe-zwb.de and this is what needs to be used in the htaccess redirect.

You must log in to answer this question.