How to redirect a URL containing smartquotes via .htaccess?

后端 未结 1 1622
夕颜
夕颜 2021-01-22 00:53

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%9C         


        
相关标签:
1条回答
  • 2021-01-22 01:37

    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
    
    0 讨论(0)
提交回复
热议问题