user277127
user277127

Reputation: 67

apache protocol redirect

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.

Upvotes: 0

Views: 1462

Answers (3)

Quentin
Quentin

Reputation: 943108

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

Upvotes: 0

David
David

Reputation: 3113

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.

Upvotes: 1

William Troup
William Troup

Reputation: 13131

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

Upvotes: 0

Related Questions