hello,
i'm having an issue setting cookies with a rewrite rule in htaccess.
my intention is to check for the presence of a cookie named "mycookiename" on all html page requests, and if not present then set it:
the code apppears to work as intended as long as the url ends in .html. however it does not work when no cookie is set and the landing page is a directory (index.html) with the url ending in /
i expect that the solution is simply correct syntax, but i cannot find any solution by searching. at this point, i've tried so many variations, figured i'd save some time and ask for help!
thanks!
i'm having an issue setting cookies with a rewrite rule in htaccess.
my intention is to check for the presence of a cookie named "mycookiename" on all html page requests, and if not present then set it:
Code:
RewriteEngine on
RewriteCond %{HTTP_COOKIE} !mycookiename
RewriteRule (.html) - [CO=mycookiename:mycookievalue:.example.com:0:/:0:1] [L]
i expect that the solution is simply correct syntax, but i cannot find any solution by searching. at this point, i've tried so many variations, figured i'd save some time and ask for help!
thanks!
Last edited by a moderator: