htaccess compare cookie value and redirect if evaluation returns true/false

前端 未结 4 1783
闹比i
闹比i 2020-12-09 20:10

I would like somebody to help me with an if-else statement in htaccess. What I want is htaccess to read a cookie and check if its value equals a defined value. If it evaluat

4条回答
  •  长情又很酷
    2020-12-09 21:04

    You're close. The cookie string needs a =:

    RewriteEngine On
    RewriteCond %{HTTP_COOKIE} !cookie_name=specific_value; [NC]
    RewriteRule ^ http://www.google.com [NC,L]
    

提交回复
热议问题