【发布时间】:2012-03-22 17:29:56
【问题描述】:
我的一个域 /site 有一个文件夹。在这里,我有一个 .htaccess 文件,其中包含:
rewriteengine on
rewritebase /
rewritecond %{HTTP_COOKIE} !allow=asdx
rewriterule ^.*$ .set-cookie.php
基本上我想将所有未将允许 cookie 设置为“asdx”的请求重定向到另一个文件。
问题是我有像/site/subdomain1 这样的文件夹,它们有自己的.htaccess 文件(带有rewriteengine on)。访问其中一个文件会使初始重定向(基于 cookie)变得无用。如果我从子文件夹中禁用 rewriteengine on 指令,则基于 cookie 的重定向将再次起作用。
如何在不实际转到各个子文件夹并将其添加到那里的情况下使基于 cookie 的重定向工作?
【问题讨论】:
标签: apache .htaccess mod-rewrite url-rewriting