.htaccess rewrite rule will not be unicode characters

I use the following ModRewrite to make my URLs cleaner:

RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?key=$1 

This allows you to use letters and numbers just fine, but when trying to use%, this results in a 400 error. I need to use Unicode characters for # / ', etc. Any reason for this? Thanks.

+2
source share
1 answer

you must use flag B in the rewrite rule. see the apache manual .

 RewriteEngine On RewriteRule ^([a-zA-Z0-9_-#$%^&]+)/?$ index.php?key=$1 [B] 

Edit : mod_rewrite uses unescaped characters, so if you want to use Unicode characters, use them in the rewrite rule and save the .htaccess file in unicode!

+2
source

All Articles