【问题标题】:AllowEncodedSlashes IssueAllowEncodedSlashes 问题
【发布时间】:2011-05-23 10:17:25
【问题描述】:

我目前在我的 Apache 服务器上遇到编码斜杠的问题。 url结构如下:

www.site.com/url/http%3A%2F%2Fwww.anotherurl.com/format/xml

然后我从 Apache 收到 404 错误(我的应用程序应该处理所有错误。)

显然AllowEncodedSlashes On 指令应该在这个地方帮助我,但它似乎并没有产生任何影响。我已经将它放在 httpd.conf 中,如下所示:

<VirtualHost *:80>
DocumentRoot /var/www/vhosts/site.com/httpdocs
ServerName site.com

AllowEncodedSlashes On
</VirtualHost>

然后使用 /etc/init.d/httpd restart 命令重新启动 Apache。

我这几天一直在尝试解决这个问题。我有人说 AllowEncodedSlashes 指令有效,有人说它有问题,应该折旧。我想知道 AllowEncodedSlashes 和 clean URL 的协同工作是否存在问题?

无论如何,感谢所有帮助。提前致谢。

【问题讨论】:

  • 我没有这方面的经验,但我猜AllowEncodedSlashes 如果在 URL 中遇到正确的斜杠,它确实不起作用。
  • 嗨佩卡!我不认为那是真的。我一直在寻找解决方案,并且遇到了其他一些人,他们设法实现了我正在尝试的目标。无论如何,谢谢。

标签: apache apache2 apache-config apache2.2


【解决方案1】:

您可以使用编码和解码 URL 来解决这种类型的问题。

  var uri = "https://w3schools.com/http%3A%2F%2Fwww.anotherurl.com/format/xml";
  var uri_enc = encodeURIComponent(uri);
  var uri_dec = decodeURIComponent(uri_enc);


After encode-
Encoded URI: https%3A%2F%2Fw3schools.com%2Fhttp%253A%252F%252Fwww.anotherurl.com%2Fformat%2Fxml

After Decode-
Decoded URI: https://w3schools.com/http%3A%2F%2Fwww.anotherurl.com/format/xml

【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 2011-03-08
      • 2012-12-04
      • 2013-12-28
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      • 2016-01-22
      • 2021-10-11
      • 1970-01-01
      相关资源
      最近更新 更多