2012-07-30 30 views
0

我正在使用.htaccess重定向和HTML meta刷新的组合以便在从备份还原网站时放入临时初始页面。HTML元刷新 - 删除文件后的错误

这里的index.html

<!DOCTYPE html> 
<html> 
    <head> 
     <title>Site Restore</title> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <meta http-equiv="refresh" content="15"> 
     <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?3.5.1/build/cssreset/cssreset-min.css&3.5.1/build/cssfonts/cssfonts-min.css&3.5.1/build/cssbase/cssbase-min.css"> 
     <style type="text/css"> 
      html { 
       background-color: #ccc; 
      } 
      div { 
       margin: 1em auto; 
       border: 1px solid #000; 
       border-radius: 0.5em; 
       padding: 1em; 
       width: 480px; 
       background-color: #fff; 
      } 
     </style> 
    </head> 
    <body> 
     <div> 
      <h1>Site Restore</h1> 
      <p>This web site is being restored from a back-up, and will be back online shortly.</p> 
      <p>If you leave this page open, it will redirect when the site restore is complete.</p> 
     </div> 
    </body> 
</html> 

.htaccess重定向:

RewriteEngine On 
RewriteBase/
RewriteRule ^.+$/[R=302,NC,L] 

备份后恢复完成后,我从.htaccess删除RewriteRule ^.+$/[R=302,NC,L]线和删除index.html文件。尽管index.html不在URL,我得到这个错误从Web服务器返回:

故宫

您没有权限访问此服务器上/index.html。 的Apache/2.2服务器在dev.swissmangocms.com端口80

如果我手动刷新浏览器窗口,index.php如我所期望的加载。我如何避免错误消息和手动步骤?

+1

听起来像一个浏览器缓存问题 – 2012-07-30 14:49:56

+0

@JonLin - 这是有道理的,但我该如何克服它? – Sonny 2012-07-30 14:51:14

回答

1

Jon Lin的评论让我看到禁用浏览器缓存的方向。我发现了另一个职位上如此,“Using tags to turn off caching in all browsers?”,并添加这些行我index.html<head>部分:

<meta http-equiv="cache-control" content="max-age=0"> 
<meta http-equiv="cache-control" content="no-cache"> 
<meta http-equiv="expires" content="0"> 
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"> 
<meta http-equiv="pragma" content="no-cache"> 

那固定的错误!