views:

65

answers:

3

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.

A: 

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

David Dorward
A: 

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

williamtroup
+1  A: 

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.

David