提供基于 cookie 的替代 Apache 目录

Serve alternative Apache Directory based on cookie

提问人:Aldo 提问时间:11/8/2023 更新时间:11/8/2023 访问量:21

问:

我有两个不同的文件夹(htdocs 和 htdocs2),我想根据 cookie 的值从第一个文件夹或第二个文件夹提供文件。 我尝试了以下方法:

 <If "%{HTTP_COOKIE} =~ /frontend=v1/">
   <Directory "/usr/local/apache2/htdocs">
   ..
   </Directory>
 </If>
 <If "%{HTTP_COOKIE} =~ /frontend=v2/">
   <Directory "/usr/local/apache2/htdocs2">
   ..
   </Directory>
 </If>

但语法无效。阿帕奇 说:

<Directory not allowed in <If> context

有没有实现目标的有效策略?

Apache 虚拟主机

评论


答: 暂无答案