Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

mod_rewrite and setenv

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


poni1111 at yahoo

Nov 1, 2009, 7:50 AM

Post #1 of 7 (856 views)
Permalink
mod_rewrite and setenv

Hello,
 
I have looked a lot in Internet, and found many people complaining about the same problem, with no normal answer.
 
My problem:
mod_rewrite with its RewriteCond %{ENV:variable} form cannot read correctly the environment variables.
 
The variable is set directly in the .htaccess OR in the main httpd.conf. No matter, the variable won't be read. THe logging of the rewrite process will show that the value of %{ENV:variable} will be "".
 
I have found the same problem posted 5 years ago, with no answer, which is awkward (if this is a bug).
 
What I wrote was:
 
SetEnv APPLICATION_ENV development
 
RewriteCond %{ENV:APPLICATION_ENV} ^development$
RewriteRule ^.*$ /XXX/index.php [NC,L]
 
Unfortunately, it doesnt work. Any experience with that? Where should I complain further?


covener at gmail

Nov 1, 2009, 8:10 AM

Post #2 of 7 (831 views)
Permalink
Re: mod_rewrite and setenv [In reply to]

On Sun, Nov 1, 2009 at 10:50 AM, Andrei Iarus <poni1111 [at] yahoo> wrote:

> Hello,
>
> I have looked a lot in Internet, and found many people complaining about
> the same problem, with no normal answer.
>
> My problem:
> mod_rewrite with its RewriteCond %{ENV:variable} form cannot read correctly
> the environment variables.
>
> The variable is set directly in the .htaccess OR in the main httpd.conf. No
> matter, the variable won't be read. THe logging of the rewrite process will
> show that the value of %{ENV:variable} will be "".
>
> I have found the same problem posted 5 years ago, with no answer, which is
> awkward (if this is a bug).
>
> What I wrote was:
>
> SetEnv APPLICATION_ENV development
>
> RewriteCond %{ENV:APPLICATION_ENV} ^development$
> RewriteRule ^.*$ /XXX/index.php [NC,L]
>
> Unfortunately, it doesnt work. Any experience with that? Where should I
> complain further?
>
>
Variables set by SetEnvIf are set earlier than those by SetEnv. Does that
resolve your problem?

--
Eric Covener
covener [at] gmail


rbowen at rcbowen

Nov 1, 2009, 8:17 AM

Post #3 of 7 (830 views)
Permalink
Re: mod_rewrite and setenv [In reply to]

On Nov 1, 2009, at 10:50 , Andrei Iarus wrote:

> Hello,
>
> I have looked a lot in Internet, and found many people complaining
> about the same problem, with no normal answer.
>
> My problem:
> mod_rewrite with its RewriteCond %{ENV:variable} form cannot read
> correctly the environment variables.
>
> The variable is set directly in the .htaccess OR in the main
> httpd.conf. No matter, the variable won't be read. THe logging of
> the rewrite process will show that the value of %{ENV:variable} will
> be "".
>
> I have found the same problem posted 5 years ago, with no answer,
> which is awkward (if this is a bug).
>
> What I wrote was:
>
> SetEnv APPLICATION_ENV development
>
> RewriteCond %{ENV:APPLICATION_ENV} ^development$
> RewriteRule ^.*$ /XXX/index.php [NC,L]
>
> Unfortunately, it doesnt work. Any experience with that? Where
> should I complain further?
>



This is a matter of order of processing. The rewrite directives run
earlier than the SetEnv directives. You can set the env var with
mod_rewrite:

RewriteRule ^ - [E:APPLICATION_ENV=development]

--
Rich Bowen
rbowen [at] rcbowen


poni1111 at yahoo

Nov 1, 2009, 9:14 AM

Post #4 of 7 (845 views)
Permalink
Re: mod_rewrite and setenv [In reply to]

Thanks very much for the fast responses. Can this info be added in the mod_rewrite documentation, as this is very important for future questions?
 
OR: can the order of processing be changed?

--- On Sun, 11/1/09, Rich Bowen <rbowen [at] rcbowen> wrote:


From: Rich Bowen <rbowen [at] rcbowen>
Subject: Re: [users [at] http] mod_rewrite and setenv
To: users [at] httpd
Date: Sunday, November 1, 2009, 7:17 PM





On Nov 1, 2009, at 10:50 , Andrei Iarus wrote:






Hello,
 
I have looked a lot in Internet, and found many people complaining about the same problem, with no normal answer.
 
My problem:
mod_rewrite with its RewriteCond %{ENV:variable} form cannot read correctly the environment variables.
 
The variable is set directly in the .htaccess OR in the main httpd.conf. No matter, the variable won't be read. THe logging of the rewrite process will show that the value of %{ENV:variable} will be "".
 
I have found the same problem posted 5 years ago, with no answer, which is awkward (if this is a bug).
 
What I wrote was:
 
SetEnv APPLICATION_ENV development
 
RewriteCond %{ENV:APPLICATION_ENV} ^development$
RewriteRule ^.*$ /XXX/index.php [NC,L]
 
Unfortunately, it doesnt work. Any experience with that? Where should I complain further?





This is a matter of order of processing. The rewrite directives run earlier than the SetEnv directives. You can set the env var with mod_rewrite:


RewriteRule ^ - [E:APPLICATION_ENV=development]



--
Rich Bowen
rbowen [at] rcbowen


aw at ice-sa

Nov 1, 2009, 11:36 AM

Post #5 of 7 (824 views)
Permalink
Re: mod_rewrite and setenv [In reply to]

Andrei Iarus wrote:
> Thanks very much for the fast responses. Can this info be added in the mod_rewrite documentation, as this is very important for future questions?
>
It's already there, see :
http://httpd.apache.org/docs/2.2/env.html
Some Caveats

> OR: can the order of processing be changed?
>
Are you kidding ?

---------------------------------------------------------------------
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 [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


covener at gmail

Nov 1, 2009, 12:02 PM

Post #6 of 7 (820 views)
Permalink
Re: mod_rewrite and setenv [In reply to]

On Sun, Nov 1, 2009 at 2:36 PM, André Warnier <aw [at] ice-sa> wrote:
> Andrei Iarus wrote:
>>
>> Thanks very much for the fast responses. Can this info be added in the
>> mod_rewrite documentation, as this is very important for future questions?
>>
>
> It's already there, see :
> http://httpd.apache.org/docs/2.2/env.html
> Some Caveats

Added similar text to SetEnv today.

--
Eric Covener
covener [at] gmail

---------------------------------------------------------------------
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 [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


poni1111 at yahoo

Nov 2, 2009, 12:50 AM

Post #7 of 7 (816 views)
Permalink
Re: mod_rewrite and setenv [In reply to]

I am sorry, I looked only at "Using Environment Variables", "URL Rewriting", as I needed to read it (use it), and not to set it :) So a suggestion would be to move the info to that paragraph (eventually to put link to "Some Caveats" ?)
 
ANYWAY, I would expect this info also in the mod_rewrite, RewriteCond's documentation page.

Thanks a lot.
Have a nice day!

--- On Sun, 11/1/09, André Warnier <aw [at] ice-sa> wrote:


From: André Warnier <aw [at] ice-sa>
Subject: Re: [users [at] http] mod_rewrite and setenv
To: users [at] httpd
Date: Sunday, November 1, 2009, 10:36 PM


Andrei Iarus wrote:
> Thanks very much for the fast responses. Can this info be added in the mod_rewrite documentation, as this is very important for future questions?

It's already there, see :
http://httpd.apache.org/docs/2.2/env.html
Some Caveats

> OR: can the order of processing be changed?
>
Are you kidding ?

---------------------------------------------------------------------
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 [at] httpd
  "   from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.