开发者

apache protocol redirect

开发者 https://www.devze.com 2022-12-20 22:57 出处:网络
Is it possible to have apache get a request like whateverProtocol://localhost and redirect it to http://localhost?

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 redi开发者_JAVA百科rect 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.


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.


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).


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

0

精彩评论

暂无评论...
验证码 换一张
取 消