如何通过重定向的.htaccess包含smartquotes一个网址? [英] How to redirect a URL containing smartquotes via .htaccess?

查看:201
本文介绍了如何通过重定向的.htaccess包含smartquotes一个网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法来重定向通过的.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-\xE2\x80\x9Crules\xE2\x80\x9D-for-social-advertising

这篇关于如何通过重定向的.htaccess包含smartquotes一个网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆