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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > Setting environment variables in .htaccess

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-16-2012, 07:05 AM
Gerry Gerry is offline
Member
 
Join Date: Feb 2008
Posts: 29
Default Setting environment variables in .htaccess

It seems environment variables don't work as expected on LiteSpeed and aren't compatible with the way Apache does things.

I have this, which works on Apache:

Code:
SetEnvIf Request_URI "^/path/to/admin.*$" adminUri

AuthName "Password protected"
AuthType Basic
AuthUserFile ./.htpasswd
Require valid-user

Order Deny,Allow
Deny from all
Allow from env=adminUri
Satisfy any
Searching around brought up that LiteSpeed doesn't handle SetEnvIf at all and that it should be done with rewriterules. The problem is that it doesn't work either:

Code:
RewriteRule ^/path/to/admin - [E=AppDisablePasswordProtect:1]

AuthName "Password protected"
AuthType Basic
AuthUserFile ./.htpasswd
Require valid-user

Order Deny,Allow
Deny from all
Allow from env=AppDisablePasswordProtect
Satisfy any
Furthermore, setting an environment variable and using it in, for example, PHP doesn't work either:

Code:
RewriteRule (.*) - [E=FOO:BAR]
PHP Code:
<?
print_r
($_ENV);
Any pointers on how to solve these two issues?
Reply With Quote
 

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 03:45 PM.



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