Sometimes your site needs downtime so you can fix things or update extensions. Most of the time, this is usually a relatively short period during which Google is unlikely to try to crawl your website. However, if you need more time to fix things, the chances are much higher GoogleBot may come to visit and encounter a website left behind. So how do you prevent Google from losing your website?

HTTP status codes and you

For those unfamiliar with HTTP status codes, here is a brief summary of those that apply to you when maintaining a site:

  • 200 OK. This status code indicates that the server returned the response successfully.
  • 301 Moved permanently. This tells the browser that this page is no longer valid and redirects to the correct page.
  • 302/307 Moved temporarily. There is some history behind these two HTTP status codes, but this requires the browser to temporarily redirect the browser to another page and that the current URL will eventually return to its previous state.
  • 404 not found. This status code means that the page you tried to navigate to was not found.
  • 410 Content deleted. Use this if you intentionally delete your content and it will not be replaced. Learn more how to delete pages correctly.
  • 503 The service is not available. You will want to return this to Google when you are working on maintaining the site. It tells Google that you are actually working on this page or that something else went wrong. Google knows that when this status code is returned, please check the page again later. We will discuss this a little more.

Please note that Google maintains pages that return 200 HTTP status codes despite an error (or very little content) on the page. “soft 404“in. Google Search Console.

Read more: HTTP status codes »

Tell Google you’re busy

If Google encounters 404 when crawling your site, it will usually throw that page out of the search results until it returns next time to make sure the page has returned. However, if Google repeatedly encounters 404 on that page, it will eventually delay crawling, which means it will take more time for the page to return to search results.

You can overcome this potential longer investment loss by resetting the 503 status code while working on a specific page. 503 – original definition of the status code this RFC, Is:

The server is currently unable to process the request due to a temporary server overload or maintenance. It is intended that this is a temporary condition that will be alleviated after some delay. If known, the length of the delay MAY be reported in the Retry header. If no retry is given, the customer MUST process the response in the same way as for 500 responses.

This means that 503 is returned along with a Retry-After a title that tells Google how many minutes to wait before returning. This No means that Google will re – crawl in exactly X minutes, but it will ensure that Google does not return to watch at any time before that.

Add a title

If you want to implement a title, you can select a few options.

Using WordPress Defaults

By default, WordPress already restores 503 when updating plug-ins or the WordPress kernel. With WordPress, you can override the default maintenance page by adding a maintenance.php your wp-content/ directory. Note that you are then responsible for properly restoring the 503 header. Are you planning to maintain the database? You also have to take care of it. More db-error.php file yours wp-content/ and make sure you also return the 503 header correctly here.

If you want to add something more enjoyable to your WordPress website, check it out WP service mode. This extension also adds a lot of additional features in addition to what we mentioned in the previous section.

If you’re just writing your own code and want an easy-to-implement solution, you can add the following code snippet to your code base and call it code that determines if you’re in service mode:

function set_503_header() {

    if ( $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1' ) {

    header( $protocol . ' 503 Service Unavailable', true, 503 );
    header( 'Retry-After: 3600' );

Notice that 3600 the code snippet dictates the delay time in seconds. This means that the sample above will prompt GoogleBot to return in an hour. You can also add a specific date and time inside Retry-After, but you need to be careful about adding this here, because adding an incorrect date can lead to unexpected results.

Pro tips


There are a few things you need to consider when working with service pages and resetting 503 status codes. If you are actively using caching, you may encounter a situation where the cache does not pass 503 mode correctly, so be sure to test this correctly before actively using this in the live version of your website.


Did you know that it is also possible to recover a 503 status code for a robots.txt file? Google announces its robots.txt instructions that you can temporarily stop crawling by throwing 503 into your robots.xt file. The biggest advantage is the lower load on the server during maintenance cycles.

Handle your maintenance well!

As we’ve seen, you can avoid losing your rankings by adding a value of 503 when you do site maintenance so that Google knows it can come back to crawl your site later. There are several ways to do this. Choose the one that works best for you and you have a well-maintained site without the risk of losing your investment. Congratulations!

Continue reading: What redirection should I use? »


Please enter your comment!
Please enter your name here