重定向包含流氓字符的网址
我们的网站上有一些抓取错误,我正在尝试编写重写规则来修复它们。我想说的是任何以 http://www.mysite.com/co 开头的网址它应该被重定向到一个单一的网址。
RewriteEngine On
RewriteBase /
RewriteRule ^co http://www.othersite.com/ [R=301,NC,L]
但是,这不适用于以下网址
http://www.mysite.com/community/membe%3Cbr%3E%3Chr%3EタグOKです。%3Cbr%3E%3Ctextarea%20name=
有什么想法可以实现这一点吗?
谢谢
詹姆斯
We have some crawl errors on our site and I'm trying to write a rewrite rule to fix them. What I want to say is that any url which begins with http://www.mysite.com/co that it should be redirected to a single url.
RewriteEngine On
RewriteBase /
RewriteRule ^co http://www.othersite.com/ [R=301,NC,L]
However, this doesn't work for the following urls
http://www.mysite.com/community/membe%3Cbr%3E%3Chr%3EタグOKです。%3Cbr%3E%3Ctextarea%20name=
Any ideas how I can achieve this?
Thanks
James
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许最简单的方法是白名单 - 重定向任何包含不在您的允许字符列表中的字符的内容。在此示例中,假设您只允许使用小写字母、数字 4 和斜杠:
Perhaps the easiest way would be whitelisting - redirect anything which contains characters not on your list of allowed characters. In this example, let's say you'd allow only lowercase letters, number 4, and the slash: