LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Apache Migration/Compatibility > [solved] htaccess SetEnv

Reply
 
Thread Tools Display Modes
  #1  
Old 04-20-2013, 01:34 PM
zolll zolll is offline
New Member
 
Join Date: Apr 2013
Posts: 3
Default [solved] htaccess SetEnv

Hello,

Due to the increased number of users on our web page, we have to migrate it from Apache to Litespeed. However, there is one problem: we use SetEnv commands within htaccess file in order to set some environment variables, for ex:

SetEnv USER user1

This works well in Apache, but not in Litespeed - it has no effect. We have tried lots of other commands using RewriteRules, such as:

RewriteRule ^ - [E:USER=user1]
RewriteRule . - [E:USER=user1]
RewriteRule ^(.*) [E:USER=user1]
RewriteRule ^(.*) - [E:USER=user1]

... and so on, but none of them sets the environmental variables. Obviously I do call "RewriteEngine On" before calling RewriteRule commands.

I can list all the environmental variables using phpinfo() call, but none of the entries within .htaccess sets any of the variables. I can set these directly within the php code ($_SERVER['USER'] = "user1"; ) and it works fine.

I have looked all over the internet and couldn't find a solution that works from the .htaccess. Can you advise please?

Thanks!

Last edited by NiteWave; 04-21-2013 at 06:32 PM..
Reply With Quote
  #2  
Old 04-21-2013, 12:25 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
apache document:
http://httpd.apache.org/docs/current...gs.html#flag_e

Quote:
RewriteRule ^ - [E:USER=user1]
RewriteRule . - [E:USER=user1]
RewriteRule ^(.*) [E:USER=user1]
RewriteRule ^(.*) - [E:USER=user1]
should work:
RewriteRule . - [E=USER:user1]
Reply With Quote
  #3  
Old 04-21-2013, 01:46 AM
zolll zolll is offline
New Member
 
Join Date: Apr 2013
Posts: 3
Default Not working

Under Apache the following line works perfectly:
RewriteRule ^(.*) - [E:USER=user1]

Under Litespeed it doesn't set anything.

I also tried your suggestion, that doesn't set the variable either.

Any other suggestions?
Reply With Quote
  #4  
Old 04-21-2013, 03:35 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
I did test on
Quote:
RewriteRule . - [E=USER:user1]
which in document root .htaccess

then access
http://192.168.2.101/phpinfo.php

_SERVER["USER"] user1

is there. so it works as expected.

please check
AllowOverride
setting in httpd.conf for this virtual host.
Reply With Quote
  #5  
Old 04-21-2013, 01:26 PM
zolll zolll is offline
New Member
 
Join Date: Apr 2013
Posts: 3
Default It works!

I've tried this and it worked indeed, thanks for the help!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:34 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.