【问题标题】:mod_rewrite and referrer check, browser auto redirects when it shouldntmod_rewrite 和referrer 检查,浏览器在不应该的时候自动重定向
【发布时间】:2013-09-19 07:26:29
【问题描述】:

我的网站上有一个页面,称为 B.html,它使用通过 mod_rewrite 进行的推荐人检查。如果它们不是来自 A.html,它会将它们重定向到 A.html。

从A开始,工作文件。他们可以链接到 B 并查看 B。如果他们尝试通过在浏览器中键入 URL 来访问 B,浏览器会将他们重定向到 A。

问题是,如果他们通过外部链接访问该站点,它会将他们重定向到 A.html(应该如此)。在此之后,如果他们点击从 A 到 B 的链接,它会将他们转发回 A。

我的第一印象是这是一个缓存问题,因为如果我关闭浏览器并重新打开它(或在私人浏览器窗口中尝试),它会从 A 链接到 B。我已尝试将此添加到页面 B 和 A:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

甚至在我的 php 代码中(不是同时):

header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
header('Pragma: no-cache'); // HTTP 1.0.
header('Expires: 0'); // Proxies.

我从这里的另一篇文章中找到的,但这并没有奏效。

有什么建议吗?

谢谢

【问题讨论】:

    标签: .htaccess caching redirect mod-rewrite rewrite


    【解决方案1】:

    如果有人有兴趣,我发现了我的问题。我在 htaccess 中使用 301 重定向,所以 broeser 会自动缓存重定向。它与页面的缓存无关。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-26
      • 1970-01-01
      • 1970-01-01
      • 2012-05-10
      • 2011-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多