为什么Firefox继续显示index.htm,而现在只有index.php存在?



我曾经在我的网站上有一个页面叫做:

http://www.tanguay.info/run/index.htm

我经常去参观它:

http://www.tanguay.info/run

我的Firefox浏览器,没有其他浏览器。

我已经删除了文件"index.htm",并将其替换为"index.php"。

现在当我进入:

http://www.tanguay.info/run

在我的Firefox浏览器中,仍然显示不存在的index.htm页面的内容。

如果我显式地转到

http://www.tanguay.info/run/index.htm

会正确显示错误,如果我显式地转到

http://www.tanguay.info/run/index.php

可以正确显示PHP页面。

清除了Firefox浏览器中所有的缓存,但它仍然显示不存在的index.htm页面。

我测试过的所有其他机器上的浏览器,甚至Firefox,当它们访问

时,都会显示正确的页面(index.php)http://www.tanguay.info/run

为什么会发生这种情况,什么是最简单的方法(例如与htaccess文件),我强迫我的Firefox浏览器和潜在的所有其他浏览器,以前被重定向到index.htm页面,正确显示index.php页面现在?

您可以通过将其放入/run目录下的.htaccess文件中来确保所有请求都转到index.php文件。你需要确保你已经在Apache配置中启用了mod_rewrite。

<IfModule mod_rewrite.c>
    ## Turns ModRewrite on
    RewriteEngine On
    ## Stop infinite loops
    RewriteCond %{ENV:REDIRECT_STATUS} 200
    RewriteRule .* - [L]
    ## Allow any existing file to pass through
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule .* - [L]
    ## Pass any non-existing file to index.php
    RewriteRule ^.*$ index.php [NC,L,QSA]
</IfModule>

相关内容

最新更新