httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michele Waldman" <>
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

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?


-----Original Message-----
From: Dave Ingram [] 
Sent: Friday, February 06, 2009 5:55 AM
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.


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
> not exist.  Am I wrong?
> I'm thinking about adding a -e flag for environment variable does not
> 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

View raw message