如何通过重定向的.htaccess包含smartquotes一个网址?重定向、网址、htaccess、smartquotes

2023-09-02 00:38:32 作者:陪我听风

有没有办法来重定向通过的.htaccess包含智能引号中的网址是什么?我用下面的规则。只有最后一个似乎工作:

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]

当我浏览到 http://blog.eloqua.com/8-"rules"-for-social-advertising/ 或的 http://blog.eloqua.com/8-%E2%80%9Crules%E2%80%9D-for-social-advertising 不重定向。

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.

但是,如果我去的http://blog.eloqua.com/8-%25E2%2580%259Crules%25E2%2580%259D-for-social-advertising一切工作就好了。

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 your help!

推荐答案

您是对的,它滑倒通过您所提供的规则。

You are right, it's slipping passed the rules you have provided.

究其原因是因为UNI code字再由%E2%psented $ P $ 80%9C和%E2%80%9D(又名微软smartquotes)已经变成了自己的单code再在阿帕奇presentation。因此,你需要正确匹配的字节流重新$ P $中的Apache psenting这些字符。

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.

为了正确的URL重定向像这样的:

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-xE2x80x9CrulesxE2x80x9D-for-social-advertising