Forum Moderators: phranque

Message Too Old, No Replies

SetEnv â .htaccess

SetEnv doesn't work in .htaccess!

         

paul bookworm

5:51 pm on Oct 22, 2004 (gmt 0)

10+ Year Member



SetEnv doesn't work in .htaccess!
Other directives (such as AuthType, AddHandler) work!
AllowOverride is set to "All" in main (server) config file.

Why?

P.S. SetEnv works if it's in main config.

jdMorgan

6:20 pm on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Very strange...

Can you give an example of mod_setenvif code that works in httpd.conf and not in .htaccess? It might help to show the problem.

Jim

paul bookworm

7:16 pm on Oct 22, 2004 (gmt 0)

10+ Year Member



Not SetEnvIf, but SetEnv.
Any simple construction such as:
SetEnv AAAA 123

It works if it's in httpd.conf, but is empty if it's in .htaccess

P.S. Sorry for my english, don't have enough time to practice.

jdMorgan

7:37 pm on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't find much information on this, except the following:

"Directory and .htaccess context is available in Apache 1.3.7 and later."

SetEnv requires AllowOverride FileInfo

The .htaccess file must be in the filepath of the scripts you wish to set the environment variables for. If a ScriptAlias in httpd.conf is used to change the path to the script, the .htaccess file won't be processed.

I can't think of anything else... :(

Jim

paul bookworm

9:00 pm on Oct 22, 2004 (gmt 0)

10+ Year Member



Strange!
Have Tried phpinfo() and...
i see my environment var
but not "MY_VAR" as set in .htaccess
it's name REDIRECT_MY_VAR!
WHY?

paul bookworm

10:18 pm on Oct 22, 2004 (gmt 0)

10+ Year Member



BUT I DON'T HAVE ANY REDIRECTS!

paul bookworm

10:56 pm on Oct 22, 2004 (gmt 0)

10+ Year Member



And the one thing.
I tried with perl.
It's okay! Here's my MY_VAR
but in PHP I have only REDIRECT_MY_VAR

Why? What is in php.ini?