.htaccess with utf-8 characters

.htaccessapache-2.2

I am trying to use mod_rewrite to create clean url's that contain UTF-8 characters.

My .htaccess file looks like this:

RewriteEngine On
RewriteRule ^([a-zA-Z\-0-9]+)/?$ index.php?page=$1 [B]

It works for english characters, but when I try with utf-8 characters, I get a not found error.

How should I change my .htaccess file to get the job done?

Best Answer

There is no such thing as utf-8 characters in URL on server side.

All url charcters are percent-encoded. So, add percent sign to your rewrite rule and you will be fine.

RewriteRule ^([a-zA-Z\-0-9%]+)/?$ index.php?page=$1 [B]
Related Topic