Ref: Correct way to block a site if a cookie isn't present apache 2.4
We followed the answer and it didn't work.
We want to redirect to another page when the cookie does NOT exist (or contain the correct information).
We're tried this:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteRule .* - [R=503,L]
The above works as a negative condition.
We tried these examples (we've had to change the URLs to be able to post the question):
RewriteCond %{HTTP_COOKIE} !abc_f8Dple7LxGXcSUgHjFrx
RewriteRule .* www.example.co.uk/no-access [R=301,L]
RewriteCond %{HTTP_COOKIE} !^abc_f8Dple7LxGXcSUgHjFrx=([^;]+)
RewriteRule .* www.example.co.uk/no-access [R=301,L]
RewriteCond %{HTTP_COOKIE} !^abc_f8Dple7LxGXcSUgHjFrx
RewriteRule .* www.example.co.uk/no-access [R=301,L]
RewriteCond %{HTTP_COOKIE} !abc_f8Dple7LxGXcSUgHjFrx=([^;]+)
RewriteRule .* www.example.co.uk/no-access [R=301,L]
None of these are working. If we remove the ! symbol (making it a positive condition) they work.
Can someone help with this please?
We'd like to get this to work on Apache 2.2 and 2.4 as we can't get it to work on both.