允许编码斜杠问题

发布于 2024-10-07 03:53:45 字数 643 浏览 4 评论 0原文

我目前在 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 一起工作是否存在问题?

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

I am currently having issues with encoded slashes on my Apache server. The url structure is as follows:

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

I am then getting a 404 error from Apache (my application should handle all errors.)

Apparently the AllowEncodedSlashes On directive should help me in this spot, but it doesn't seem to be making any impact whatsoever. I've placed it in the httpd.conf like so:

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

AllowEncodedSlashes On
</VirtualHost>

Then restarted Apache with the /etc/init.d/httpd restart command.

I've been trying to solve this issue for days now. I've some people saying that the AllowEncodedSlashes directive works, and some people saying that it's buggy and should be depreciated. I'm wondering if there's an issue with AllowEncodedSlashes and clean URL's working together?

Anyway, all help is appreciated. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

方觉久 2024-10-14 03:53:45

您可以使用编码和解码 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

You can use encode and decode URL for this type problem.

  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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文