I need to use SetEnvIf in my .htaccess file.
I also need to fulfill several conditions, and then show the required URL.
Here is my code:
SetEnvIf Remote_Host "^" press_flag=0 SetEnvIf Request_URI '/press/$' press_flag=1 SetEnvIf Cookie 'language\_uiAAAenglishBBB' press_flag=press_flag+1 SetEnvIf press_flag 2 Request_URI='Remote_Host/eng/test.html'
Explanation:
- In the first line, I set the
press_flag variable to 0 . - The second line, I check if the URL ends with this text:
/press/ , if true, I set 'press_flag' to 1 . - The third line, I check if the cookie
language\_uiAAAenglishBBB text, if true, then I increase the value of press_flag by 1. - The last line, I check if the
press_flag value is 2, then I set HTTP_HOST accordingly.
But when I open the URL/press/ in the browser, it is not redirected.
Please help debug and fix this code.
Thanks.
source share