0

I am using a combination of .htaccess redirect and HTML meta refresh to put in a temporary splash page while restoring my web site from a backup.

Here's the 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 Redirect:

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

After the backup restore is complete, I remove the RewriteRule ^.+$ / [R=302,NC,L] line from .htaccess and delete the index.html file. Even though index.html is not in the URL, I get this error back from the web server:

Forbidden

You don't have permission to access /index.html on this server. Apache/2.2 Server at dev.swissmangocms.com Port 80

If I manually refresh the browser window, index.php is loaded as I would expect. How do I avoid the error message and manual step?

Sonny
  • 8,204
  • 7
  • 63
  • 134

1 Answers1

1

Jon Lin's comment caused me to look in the direction of disabling browser caching. I found another post on SO, "Using tags to turn off caching in all browsers?", and added these lines to my index.html <head> section:

<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">

That fixed the error!

Community
  • 1
  • 1
Sonny
  • 8,204
  • 7
  • 63
  • 134