Forum Moderators: phranque

Message Too Old, No Replies

To redirect URL having UTF codes

         

sam222

9:54 pm on Mar 14, 2014 (gmt 0)

10+ Year Member



Is there any way to redirect URLs having UTF codes. I actually want my URL example.com/mypage.htm%C2%A0 to example.com/mypage.htm with 301 so that UTF code %C2%A0 shouldn't exist any more in my URL.

g1smd

11:18 pm on Mar 14, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteRule ^mypage\.htm.+ http://www.example.com/mypage.htm [R=301,L]

lucy24

1:40 am on Mar 15, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



^mypage\.htm.+

Or simply
^mypage\.htm.

since it doesn't matter how much garbage comes after the "htm".

Caution! If your site has a mix of ".htm" and ".html" you will have to tweak the rule, for example by saying

^mypage\.htm[^l]


in the pattern.

:: detour to look up C2 and A0 ::

Yikes. What's a nonbreaking space even doing in that position? I hope it's just a sloppy cut-and-paste job from some external link. Silly place to put a nonbreaking space, though. (Someone else's silliness. Not yours!)