You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by T F <th...@gmail.com> on 2005/12/11 20:56:53 UTC

[users@httpd] force rewrite to occur before authentication, howto?

For certain requests for resources in a password protected directory,
I'd like to redirect the user to an unprotected page.  In these cases,
I'd like the user not to know that the protected directory exists. 
The problem is that the login box pops up before the rewrite -- which
clues the user into the existence of the protected directory.

I need to correct this using .htaccess files since I do not have
access to httpd.conf

I've tried placing the rewrite code in the password protected
directory's .htaccess file, in which case I've set the rewrite lines
are before the authentication lines.

I've also tried putting the rewrite lines in top directory's .htaccess file.

Any help would be greatly appreciated.

Thanks in advance,
Mike

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: force rewrite to occur before authentication, howto?

Posted by T F <th...@gmail.com>.
> > I'm still not having any luck with this.  It appears as though
> > authentication is happening before the rewrite.  I need the
> > opposite:  need rewrite before the authentication.
> >
> > Oddly, a google search turns up posts with both situations.
> > In some, people are in my boat (trying to get rewrite before auth)
> >
> > In others, people are stating that Apache actually rewrites before
> > authentication (which is want I'm after).
>
> It depends, I believe, on where you put the RewriteRules.  If they are
> in the main server context, they happen before auth.  If they are in
> .htaccess or <Directory> sections, they happen after auth.  I don't
> know of any way to work around this.

Still no luck.  So I am going to need to come up with an alternative scheme.

Thanks Joshua!

Mike

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: force rewrite to occur before authentication, howto?

Posted by Joshua Slive <js...@gmail.com>.
On 12/11/05, T F <th...@gmail.com> wrote:
> > The problem is that the login box pops up before the rewrite
>
> I'm still not having any luck with this.  It appears as though
> authentication is happening before the rewrite.  I need the
> opposite:  need rewrite before the authentication.
>
> Oddly, a google search turns up posts with both situations.
> In some, people are in my boat (trying to get rewrite before auth)
>
> In others, people are stating that Apache actually rewrites before
> authentication (which is want I'm after).

It depends, I believe, on where you put the RewriteRules.  If they are
in the main server context, they happen before auth.  If they are in
.htaccess or <Directory> sections, they happen after auth.  I don't
know of any way to work around this.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: force rewrite to occur before authentication, howto?

Posted by T F <th...@gmail.com>.
> The problem is that the login box pops up before the rewrite

I'm still not having any luck with this.  It appears as though
authentication is happening before the rewrite.  I need the
opposite:  need rewrite before the authentication.

Oddly, a google search turns up posts with both situations.
In some, people are in my boat (trying to get rewrite before auth)

In others, people are stating that Apache actually rewrites before
authentication (which is want I'm after).

for example, here is a 2001 post (same Joshua?)

http://www.mailarchives.org/list/apache-httpd-users/msg/2001/00078

RewriteRules get applied before authentication is performed.  Luckily,
Ralf thought of this problem and invented the convoluted syntax
%{LA-U:REMOTE_USER} to do an internal sub-request and grab the REMOTE_USER
value.  See:
http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteCond

tia,
Mike

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org