rekoil (rekoil) wrote in apache,
rekoil
rekoil
apache

triggering mod_rewrite rule via auth failure?

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...)
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 3 comments