Url rewrite in apache based on cookie value
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)|utmc开发者_开发问答md=(none);
jforumUserId=1; __utmc=111872281
i need to force page load to https if jforumUserId value is other than -1. Is this possible.
Try this:
RewriteCond %{HTTP:Cookie} (^|;\ *)jforumUserId=([^;\ ]+)
RewriteCond %2 !=-1
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
精彩评论