2015-08-31 66 views
2

我正在使用Web服务器。如何强制更新网页

之前:有一个网站。 “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,no-cache,no-store,must-revalidate”),但它不起作用。

下面的网络分析仪 enter image description here

回答

0

我猜这实际上是一个DirectoryIndex问题,而不是一个缓存一个。

如果你看看the documentation,你会发现这个指令取得了Apache尝试按顺序定位的索引列表。为此,你可以通过它移动到列表

DirectoryIndex index.php index.html 
+0

感谢您的回复。但是当我使用禁用缓存时,网站显示wordpress( - > index.php)。 DirectoryIndex是一个好主意,但我没有访问Apache配置...我试图将它添加到.htaccess中,但它不起作用。 –

0

如果重定向是301的前强制优先index.php,那么你需要使用“忘记这个网站”,因为301是永久重定向和意志保存在浏览器缓存中。简单的页面重新加载不会刷新缓存。

我常偶然发现了这样的情景:

foo.com使用重定向到301bar.com,当你第一次访问foo.com,浏览器会记得重定向与您亲临foo.com接下来的时间,浏览器甚至不会连接到foo.com,而是直接连接到bar.com

@edit: 它似乎是一个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。

+0

哦,不,它不是301,只是一个这个标签页:“元HTTP的当量=”刷新”内容=‘0; URL = EN/index.html的’ –

+0

好了,元刷新似乎是一个302: 。) –

+0

是的,这是;),但我想我可以禁用,因为HTML是在用户浏览器缓存:/ –