Thursday, February 17, 2011

UTF-8 URI explodes Apache & mod_rewrite

I have Apache with mod_rewrite, and whenever I enter a URI with an accented character in it, Apache gives me a "Page Not Found" error.

The URI is: /places/tags/Café

My page encoding is UTF-8. My database connection & tables are UTF-8. My Apache DefaultCharacterSet = UTF-8. Yes, Apache has language packs, but I believe they're there for page content, not URIs.

We'd prefer not to have the url encoded into percent signs and html entities, and stripping out the special characters isn't practical at the moment, on our 100 million rows of data.

Any help would be greatly appreciated.

From stackoverflow
  • Turns out I had a bad apache rewrite rule. I had been using: ([a-zA-Z0-9_-]) UTF-8 characters are not part of a-zA-Z. Change the rule to be: (.) That means any characters (ASCII, UTF-8, or othewise). Appears to work fine.

    JQman : hi, i'm facing the exact problem can you post the code here please.

0 comments:

Post a Comment