I want to use redirect 301 rules (i.e. I hope to be able to avoid rewriting rules) to redirect URLs that contain special characters (like é, à ,…) like for instance
redirect 301 /éxàmple http://mydomain.com/example
However, simply adding this doesn’t work. Any suggestions?
How to troubleshoot this on a Windows system
On Windows, you can use Notepad++ to enter Unicode characters correctly. After launching Notepad++, select ‘Encoding in UTF-8 without BOM’ from the ‘Encoding’ menu, then type your Unicode characters and save the file.
To make sure that the characters have been saved properly, download a hex editor for Windows and make sure that
éis saved asc3 89andàis saved asc3 a0.Previous response where I assumed that you are on a Linux system
Most likely the Unicode characters have not been saved properly in .htaccess file.
What do you get when you try this command:
You should get this if your Unicode characters are saved correctly.
If you have
xxdorhdinstalled, you can get a neater output to do your troubleshooting:In all the outputs you can see that
éis saved as the binary numbers:c3 89. You can see from http://www.fileformat.info/info/unicode/char/e9/index.htm that theéwhen encoded in UTF-8 is indeed two-bytes: 0xC3 and 0xA9.Similarly,
àin UTF-8 format is: 0xC3 0xA0. See http://www.fileformat.info/info/unicode/char/e0/index.htm. You can see these codes in the output as well.