triggering mod_rewrite rule via auth failure?
Date: 09/19/08
(Apache) Keywords: google
Hi,
I'm looking for a way to construct a RewriteCond that returns true only when a URL is requested without proper HTTP authentication. (The rewrite rule will generate a 301 redirect forcing the request through a proxy, where proper HTTP auth will allow direct access). So far, The Googles have not been helpful; anyone here have an idea?
Effectively, I want
http://user:pass@example.com/path/to/object
to return the object directly, but
http://user:badpass@example.com/path/to/object
or
http://example.com/path/to/object
will return a 301 to:
http://proxy.example.com/path/to/object
(The proxy will use the proper u/p to access the server, so we won't have a redirect loop...)
Source: https://apache.livejournal.com/42827.html