htaccess Redirect / RedirectMatch with URLs that contain Special / Encoded Characters

Posted by dSquared on Server Fault See other posts from Server Fault or by dSquared
Published on 2012-11-05T01:10:15Z Indexed on 2012/11/05 5:03 UTC
Read the original article Hit count: 424

Filed under:
|
|

I'm currently in the process of applying a variety of 301 redirects in an .htaccess file for a website that recently changed its structure. Everything is working as expected, except for URLs that contain special characters, for these I am getting 404 errors.

For example the following directives that have a registered trademark symbol (®) bring up 404 pages:

RedirectMatch 301 ^/directory/link-with®-special-character(/)?$ somelink.com
RedirectMatch 301 ^/directory/link-with%c2%ae-special-character(/)?$ somelink.com

I've also tried using Redirect, RewriteRule and surrounding the urls with double quotes and nothing seems to work.

Does anyone know what might be happening or the proper way to handle these types of directives?

Any help is greatly appreciated.

© Server Fault or respective owner

Related posts about .htaccess

Related posts about mod-rewrite