阿帕奇协议重定向

发布于 2024-08-22 16:50:46 字数 353 浏览 3 评论 0原文

是否有可能让 apache 获取像whateverProtocol://localhost 这样的请求并将其重定向到 http://localhost

提前致谢。

更新:谢谢您的回答。具体来说,我正在尝试将 ldap://localhost 重定向到 http://localhost——并且我相信 ldap 可能会被 mod_rewrite 识别。但到目前为止,使用 RewriteEngine/RewriteRule 还没有成功,包括使用 RewriteCond SERVER_PROTOCOL...

任何想法将不胜感激。

Is it possible to have apache get a request like whateverProtocol://localhost and redirect it to http://localhost?

Thanks in advance.

Update: Thank you for the answers. Specifically, I am trying to redirect ldap : // localhost to http : // localhost -- and I believe ldap may be recognized by mod_rewrite. But no luck so far using RewriteEngine/RewriteRule, including using RewriteCond SERVER_PROTOCOL...

Any ideas would be greatly appreciated.

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

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

发布评论

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

评论(3

甜味拾荒者 2024-08-29 16:50:46

我不明白这怎么可能行得通。 Apache 是一个 HTTP 服务器,而不是 LDAP 服务器,因此它首先不会收到请求。即使您让它为端口 631 提供请求,LDAP 客户端也不会发送 HTTP 请求,并且无法解析重定向响应。

I don't see how this could possibly work. Apache is an HTTP server, not an LDAP server, so it wouldn't get the request in the first place. Even if you had it serve requests for port 631, an LDAP client wouldn't send an HTTP request and wouldn't be able to parse a redirect response.

×眷恋的温暖 2024-08-29 16:50:46

一般来说,没有。大多数协议不包含重定向到其他协议的方法。

对于 HTTPS,您可以。这只是一个问题:

Redirect 301 / http://localhost/

...在 HTTPS 虚拟主机的配置中。

更新以响应编辑

虽然理论上可以说服 Apache 与 LDAP 对话(它的模块可以将其用作任何类型的 TCP/IP 服务器的基础),但 LDAP 客户端不能谈论 HTTP,所以这样的重定向没有任何意义。 (我认为 LDAP 也不支持重定向响应)。

In general, no. Most protocols don't include a method for redirecting to a different one.

In the case of HTTPS, you can. That is simply a matter of:

Redirect 301 / http://localhost/

… in the configuration for the HTTPS virtual host.

update in response to edit:

While it is theoretically possible to persuade Apache to talk to LDAP (modules for it can use it as the base for any kind of TCP/IP server), LDAP clients don't talk HTTP, so such a redirect wouldn't make any sense. (I don't think LDAP supports a redirect response either).

_畞蕅 2024-08-29 16:50:46

mod_rewrite 似乎是您所寻找的:

http://httpd.apache.org /docs/2.2/mod/mod_rewrite.html

希望这有一些帮助

mod_rewrite seems to be what your lookiing for:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Hope this is of some help

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