Email
Share

We Rock Your Web Forum » Web Programming

htaccess redirect accented characters?

(3 posts)
  1. Sally301

    member
    Joined: Aug '09
    Posts: 28

    I'm trying to get a URL that has a german accent in it (could also be a french accent) - bücher (books), to redirect to a non-accented URL. However, when I try the following redirect in my .htaccess file, I can't get it to work (ie. nothing happens).

    RewriteRule ^bücher$ http://example.com/bucher$1 [R=301,L]

    Any ideas how to implement this redirect correctly - in other words, how to get htaccess to recognize my character accent?

    Posted 2 years ago #

  2. Posted 2 years ago
  3. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    While we don't know of a way to represent accented characters in htaccess, you can use a universal character match to cover the accented character as follows:

    redirectMatch 301 ^/b.+cher http://example.com/bucher

    Posted 2 years ago #
  4. Sally301

    member
    Joined: Aug '09
    Posts: 28

    Awesome - that did it. I've been searching ages for this, inserting the names of different languages to try and find a discussion on htaccess handling URLs with accented characters. Your redirectMatch method did the trick - thanks!

    Posted 2 years ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.