httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michele Waldman" <mmwald...@nyc.rr.com>
Subject RE: Making mod_auth_digest mysql
Date Fri, 06 Feb 2009 13:49:50 GMT
I mean to check server environment variables which is what REMOTE_USER is.

I just want to know if the variable is defined on the server then I could do
this:

RewriteEngine On
RewriteCond %{REMOTE_USER} -e
RewriteRule ^(.*)$ - [S=1]
RewriteRule ^.*$ http://domain/login.html [R]

Right now when REMOTE_USER is not defined this line gets executed:
RewriteRule ^(.*)$ - [S=1]

I want that line to be skipped if REMOTE_USER has not been defined as a
server environment variable.

You can see the values in phpinfo();  It is only defined if the user is
logged in.

Why would a nonexistent variable evaluate to true?

Michele

-----Original Message-----
From: Dave Ingram [mailto:dave@dmi.me.uk] 
Sent: Friday, February 06, 2009 5:55 AM
To: modules-dev@httpd.apache.org
Subject: Re: Making mod_auth_digest mysql

The -f and -d flags for RewriteCond are for checking the file system,
not environment variables, although they can use environment variables
if necessary. For example:

RewriteCond %{DOCUMENT_ROOT}/%{ENV:foo} -d

would check that the folder named by the environment variable "foo"
exists in the document root.


Dave


Michele Waldman wrote:
> RewriteCond has flags -f -d ...
> But not -e for exists.
> It looks like:
> RewriteCond ${REMOTE_USER} !="" always evaluates to true if REMOTE_USER
does
> not exist.  Am I wrong?
> I'm thinking about adding a -e flag for environment variable does not
exist
> to httpd on my server.  It would return true if the variable exists or
> false, otherwise.
> Is there a way to already do this?
> Thoughts?
>
> Michele
>
>
>   


Mime
View raw message