I have found a solution. This part of my original question
RewriteCond %{QUERY_STRING} skip [NC] RewriteCond %{HTTP_COOKIE} ^.*test_%{HTTP_HOST}=tmp.*$ [NC] RewriteRule ^(.*)$ - [L]
should be replaced by the following
RewriteCond %{QUERY_STRING} skip [NC] RewriteCond %{HTTP_HOST}@@%{HTTP_COOKIE} ^([^@]*)@@.*test_\1=tmp.* [NC] RewriteRule ^(.*)$ - [L]
Only the second RewriteCond is changed. Its left side ( %{HTTP_HOST}@@%{HTTP_COOKIE} ) combines the http and cookie host values, using @@ as a glue (@@ doesnβt really mean something, itβs unlikely to be used on a regular host or file line cookie).
The right-hand side ( ^([^@]*)@@.*test_\1=tmp.* ) ^([^@]*)@@.*test_\1=tmp.* everything with the first "@", which is the host name, and then checks to see if it can be found somewhere in cookie values preceded by "test_" and then "= TMP".
source share