I am having trouble finding information on Apache mod_rewriting using Chinese characters (all the info I can find relates to numbers).
I want to rewrite /character.php?character=宠
(where the character is the result of a search and thus will vary) to /character/宠
.
This is my (poor) attempt:
RewriteRule ^character/?$ characters?character=$1 [NC,L]
I would appreciate any help.
Thanks, Dan
Enable mod_rewrite and .htaccess through
httpd.conf
and then put this code in your.htaccess
underDOCUMENT_ROOT
directory:First of all, your Regular Expression is incorrect. Using the
?
tellsmod_rewrite
that the character before it is optional. It is not a placeholder for any character.You should be doing this instead:
This rule assumes you want to only capture one character. If this is not the case, or you need the same rule elsewhere, then swap out
(%[A-Z0-9]{3})
for(%[A-Z0-9]+)
.You also need to make sure that your
.htaccess
file is saved in Unicode format (UTF-8).