: Apache .htaccess: Is it possible to write an if condition for a cookie value check? I want to write an if condition in an .htaccess file to check whether a cookie value is set. Example
I want to write an if condition in an .htaccess file to check whether a cookie value is set. Example code:
<If "%{HTTP_COOKIE} == 'cookiename and value'">
...
</If>
More posts by @Nickens628
2 Comments
Sorted by latest first Latest Oldest Best
We can also the below code
<If "%{HTTP_COOKIE} =~ /tenant=666/">
SetEnv lang4 777
Header add Set-Cookie "logged=%{lang4}e;"
</If>
Where tenant is cookie-name and 777 is cookie-value
This seems to do the trick for me:
<If "%{HTTP_COOKIE} =~ /(^|; )cookie-names*=s*some-val(;|$)/>
The s* part is probably overkill.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.