Google told what to do, if you want to temporarily close the site
Google employee John Mueller said, as not to lose position in the search engine, if you need to temporarily suspend the operation of the site (day and more) for maintenance or other reasons.
Mueller suggested three options:
To block the functionality of the shopping
In most cases, the page with the basket of goods can be blocked from indexing via the file robots.txt or using the meta tag robots. The result is search engines will not see and index this content. You also need to inform the users. For example, you can disable the link to the cart, add the appropriate message or show an information page instead of the basket.
Always show pop-up message
If you need to block the website from users, use the message temporarily unavailable on information page or pop-up window. The server must return a 503 error (Service temporarily unavailable). Response code 503 ensures that Google does not index temporary content that will be shown to users. If server returns not error 503, then the search engines will index pop-up message as the content of the site.
For about a week, Googlebot will try to scan the pages that return a response code of the server 503. Then this error will be regarded as a constant, which can lead to the loss of pages from the search results.
You can also use the Retry-After header to indicate a time interval after which the robot shall visit the page.
It is important to note that the blocking site for more than weeks may have a negative impact on its position in the search results, regardless of the used method.
To completely disable the website
Another option is a complete server shutdown. For example, when you move the server to another datacenter. For this you must have a temporary server that returns the 503 response code for all URLS (showing relevant information for users). You also need to configure the DNS server so that it is temporarily pointing at this server.
- A few days before the maintenance change down the TTL in the DNS server (for example, set it for five minutes).
- Set the DNS server IP the address of the temporary server.
- As soon as all requests will be on a temporary server disconnect main.
- After completion of the work connect to your primary server.
- Change the DNS settings, specifying the IP address of the server.
- Return the previous value of the parameter TTL.