如何通过编码的字符,如%2f和%2B的网址是什么?(How to pass encoded char

2019-10-22 21:53发布

我通过使用.htaccess文件的URL传递加密值如下所示:URL:

http://www.website.com/folder1/f1/tdT9Eu%2b8kmAe1U%2ft12RS

htaccess文件:

RewriteRule ^f1/(.+)$  index.php?id=$1 [NE]

该问题是由请求的URL,服务器响应此服务器上找到。 但是当我更换%2f/%2b b s+它完美的作品,我可以看到页面的内容。

它的工作原理也很好,当我使用没有任何重写的网址如下图所示:

http://www.website.com/folder1/index.php?id=tdT9Eu%2b8kmAe1U%2ft12RS

能否请您提供帮助的,我怎么能修改我的htaccess的,使这项工作? 因为我需要使用URL重写来获取内容如上图所示

Answer 1:

正是由于存在%2f中的URI通常不是由Apache Web服务器允许的默认。 它在查询字符串允许的,这就是为什么?id=...是工作的罚款。

您需要打开AllowEncodedSlashes指令在Apache配置这一点。

采用:

AllowEncodedSlashes On

允许编码的斜杠的URI并重新启动Apache Web服务器。



Answer 2:

我想你会发现你这里寻找答案: .htaccess的重写规则,接受特殊字符

基本上,它更改为RewriteRule ^f1/(^/.+)$ index.php?id=$1 [NE]



文章来源: How to pass encoded characters like %2f and %2b in a url?