将编码字符添加到url会打破htaccess [英] Adding encoded chars to the url breaks htaccess

查看:239
本文介绍了将编码字符添加到url会打破htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

RewriteEngine on
RewriteRule page/(.*) index.php?url=$1 [NC]

当我访问 page / http://google.com/ =工作正常

当我访问 page / http% 3A%2F%2Fgoogle.com%2F =服务器报告404

When I access page/http://google.com/ = works just fine
When I access page/http%3A%2F%2Fgoogle.com%2F = server reports 404

Martti Laine

Martti Laine

推荐答案

当你在请求中编写斜杠时,Apache会返回一个(有点不直观)404,但没有 AllowEncodedSlashes 设置为打开。要确认是这种情况,请检查您的错误日志,其中可能包含这样的条目:

Apache returns a (somewhat non-intuitive) 404 in cases when you have encoded slashes in the request, but do not have AllowEncodedSlashes set to on. To confirm this is the case, check your error log, which likely contains an entry like this:


发现%2f )in URI
(decoded ='/ page / http://google.com/ ),
正在返回404

found %2f (encoded '/') in URI (decoded='/page/http://google.com/'), returning 404

这篇关于将编码字符添加到url会打破htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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