Reputation: 9224
I want to set a cookie called “front door” with content “1” for IP address 123.255.123.255 on my website “example.com”. No redirect suppose to happen, just set the cookie.
This is what I got, but it is not working. Does anyone can help me to figure out why its not working?
Thank you so much!
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^123\.255\.123\.255
RewriteRule ^.* [CO=frontdoor:1:.example.com]
Upvotes: 3
Views: 4779
Reputation: 41219
Your RewriteRule is missing a target path "-" , time and path fields are also missing in the Cookie flag, so by default it will set cookie on the entire site and it will be valid for the current browser session only.
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^123\.255\.123\.255
RewriteRule ^.* - [CO=frontdoor:1:www.example.com]
Upvotes: 3