Reputation: 1873
can we write rewrite rules in apache based on the value available in cookie. below is the sample cookie value (from firebug). In this i need to control my rewrite rule based on the value jforumUserId
JSESSIONID=96A0AFA5E2EE4500C8483679DA530041;
__utma=111872281.1699469794.1302588971.1305090522.1305099051.66;
__utmz=111872281.1302588971.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
jforumUserId=1; __utmc=111872281
i need to force page load to https if jforumUserId value is other than -1. Is this possible.
Upvotes: 9
Views: 15042
Reputation: 655219
Try this:
RewriteCond %{HTTP:Cookie} (^|;\ *)jforumUserId=([^;\ ]+)
RewriteCond %2 !=-1
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
Upvotes: 18