Quantcast
Channel: DBWebwork » Apache
Viewing all articles
Browse latest Browse all 2

Preparing a website for downtime during maintenance

$
0
0

cc-Winfried-Bruenken3I’m getting ready to deploy a website, and I don’t want to hurt my customer’s SEO during the downtime. I did some research, and found some best practices recommended by Google and SEOMOZ, an SEO blog. Here’s what I learned.

  • You don’t want to let your server just send up 404 Page Not Found messages to the search engine indexing robots. That can do real harm to search engine rankings. This will happen if all files are removed from the server.
  • You also don’t want to put a simple message page telling human visitors about the closure if it doesn’t also send a proper header code to the indexers.
  • What you want, instead, is 503 Service Unavailable. Add a few extra niceties to handle this gracefully.

SEOMOZ provides a great reference.

Create a 503.php file:

<?php
header("HTTP/1.1 503 Service Temporarily Unavailable");
header("Status: 503 Service Temporarily Unavailable");
header("Retry-After: 3600");
?>

The last item can be in seconds or a GMT date.

You still need to redirect visitors who are coming in to other pages on your site, and for that you need to redirect visitors to the 503.php file.

Edit an .htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^00\.00\.00\.00
RewriteCond %{REQUEST_URI} !^/503.php [NC]
RewriteRule .* /503.php [R,L]

To give yourself access to the site, while keeping others out, add your own IP address or subnet mask to {REMOTE_ADDR}.

Then: how to tell your human visitors? Add some HTML messaging to your 503.php file.

<?php
header("HTTP/1.1 503 Service Temporarily Unavailable");
header("Status: 503 Service Temporarily Unavailable");
header("Retry-After: 3600");
<html>
<head>
<title>Site is temporarily unavailable due to server maintenance.</title>
</head>
<body><h1>Site is temporarily unavailable due to server maintenance.</h1>
<p>We expect to be online again in 1 hour!</p>
</body>
</html>
?>

I tried testing this out on my server, but was unable to get it to work either locally or on my shared hosting service. I think this is because error handling is being overridden by the hosting service settings, which I could not alter. Locally, I think this just doesn’t work. I’ll be trying it out when I update my client’s site.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images