Is there a way to redirect a URL containing smart quotes via .htaccess? I'm using the following rules. Only the last one seems to work:
RewriteRule ^8-%E2%80%9Crules%E2%80%9D-for-social-advertising$ /8-rules-for-social-advertising [R=301,L]
RewriteRule ^8-“rules”-for-social-advertising$ /8-rules-for-social-advertising [R=301,L]
RewriteRule ^8-%25E2%2580%259Crules%25E2%2580%259D-for-social-advertising$ /8-rules-for-social-advertising [R=301,L]
When I surf to http://blog.eloqua.com/8-“rules”-for-social-advertising/ or http://blog.eloqua.com/8-%E2%80%9Crules%E2%80%9D-for-social-advertising it doesn't get redirected.
But if I go to http://blog.eloqua.com/8-%25E2%2580%259Crules%25E2%2580%259D-for-social-advertising everything works just fine.
What am I doing wrong? Thanks so much for y开发者_如何转开发our help!
You are right, it's slipping passed the rules you have provided.
The reason is because the unicode characters represented by the %E2%80%9C and %E2%80%9D (aka microsoft smartquotes) have already been turned into their unicode representation within Apache. As such you need to properly match the bytestream representing those characters within apache.
In order to properly redirect urls such as this:
http://www.example.com/8-%E2%80%9Crules%E2%80%9D-for-social-advertising
You would use a rule like this:
http://www.example.com/8-\xE2\x80\x9Crules\xE2\x80\x9D-for-social-advertising
精彩评论