4

I have set some variables in .htaccess file with SetEnv but it's not getting by php file using $_SERVER.

Here is the code of htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
AddDefaultCharset utf-8

# Enviroment variables; change these to match server configurations
SetEnv ENVIRONMENT development
SetEnv APP_DB_HOSTNAME localhost
SetEnv APP_DB_USERNAME root
SetEnv APP_DB_PASSWORD root
SetEnv APP_DB_NAME root_pro
SetEnv APP_ENC_KEY xxxxx-xxx-xxx

But I didn't got the value in $_SERVER['ENVIRONMENT']. Please give advice on it please.

Note: This is not working in my live server and there is already mod_env already enabled.

Thank you in advance.

Chetan Nakum
  • 413
  • 6
  • 19

1 Answers1

0

Make sure AllowOverride is set to FileInfo (or All):

AllowOverride FileInfo

inside the relevant directory.

Also it might be possible that the environment variables were removed by suexec.

JochenJung
  • 7,183
  • 12
  • 64
  • 113