Php 如何强制刷新网页
我正在网络服务器上工作 以前:有一个网站。“domain.com/”重定向到“domain.com/index.html”(逻辑),此页面重定向到“domain.com/en/index.html”,标签为: “meta-http equiv=“refresh”content=“0;url=en/index.html“” 现在:有一个Wordpress(我安装了它),没有index.html,但有一个index.php 问题是:当我想访问“domain.com”时,我被重定向到domain.com/en/index.html 我知道这是缓存问题,但如何禁用此缓存。重定向 我找到了一个关于htaccess的解决方案(添加标题集缓存控制“max age=0,无缓存,无存储,必须重新验证”),但它不起作用 在网络分析器下面Php 如何强制刷新网页,php,html,wordpress,.htaccess,redirect,Php,Html,Wordpress,.htaccess,Redirect,我正在网络服务器上工作 以前:有一个网站。“domain.com/”重定向到“domain.com/index.html”(逻辑),此页面重定向到“domain.com/en/index.html”,标签为: “meta-http equiv=“refresh”content=“0;url=en/index.html“” 现在:有一个Wordpress(我安装了它),没有index.html,但有一个index.php 问题是:当我想访问“domain.com”时,我被重定向到domain.co
我猜这实际上是一个
目录索引问题,而不是缓存问题
如果查看,您会发现该指令获取了一个索引列表,Apache会按顺序尝试查找这些索引。因此,您可以通过将index.php
移动到列表的前面来强制其优先级
DirectoryIndex index.php index.html
如果重定向是301,则需要使用“忘记此站点”,因为301是永久重定向,将保存在浏览器缓存中。简单的页面重新加载不会刷新缓存
我经常遇到这样的情况:
foo.com
使用301
重定向到bar.com
,当您第一次访问foo.com
时,浏览器会记住重定向,下次访问foo.com
时,浏览器甚至不会连接到foo.com
,而是直接连接到bar.com
@编辑:
这似乎是一个302重定向。
只需编辑yourwebsite.com/index.html
并从meta-http-equiv=“refresh”content=“0;url=en/index.html
更改为meta-http-equiv=“refresh”content=“0;url=en/index.php
。基本上,在刷新元数据中将扩展名从.html更改为.php。感谢您的回复。但是当我使用禁用的缓存时,网站会显示wordpress(->index.php)。DirectoryIndex是个好主意,但我还没有访问apache配置。。。我试图将它添加到.htaccess中,但它不起作用。哦,不,它不是301,只是一个带有以下标签的页面:“meta-http equiv=“refresh”content=“0;url=en/index.html“是的,就是这样;)但我想我可以禁用它,因为html在用户浏览器缓存中:/