You have to do WordPress maintenance work on your WordPress site now and then. You need to install the latest software updates. This will make it stop working for a short time. Sometimes you need to do more elaborate changes, and the site will be in a confused state till you’re done. You could leave it online, but it would be a mess.
You can take the site offline, but shouldn’t look to readers and search engines as if it has vanished. To avoid this impression, WordPress has to return the right HTTP code. Let’s talk a little about these codes and what they mean.
Most requests on the Web use the HTTP or HTTPS protocol. You can tell which protocol a request uses by the first few characters of the URL (link). An HTTP request begins with “http:” and an HTTPS request begins with “https:”.
When a server responds to an HTTP or HTTPS request, it sends a numeric code. If everything is working right, the code is 200, and the requested data accompanies it. Things can go wrong in lots of ways, and there are lots of codes for different problems.
The best known problem code is 404, for “not found.” Unless you’re permanently taking down some pages or your whole site, you don’t want the viewer to see this code. People who see it may think the site no longer exists. Search engines will reach the same conclusion, and your site will disappear from search results. When you get it running again, they’ll eventually find it, but it could be invisible to searches for hours or more.
Other codes are almost as bad. A return code of 500 (internal server error) can appear when something unexpected goes wrong. This can happen if you’re experimenting with plugins or custom PHP code. It creates a really bad impression. People might think the site doesn’t work with their browser, or at all.
The right code to return during maintenance time is 503, which officially means “service unavailable.” That may not sound much better than 404, but search engines and Internet geeks understand that it means a temporary situation.
When you’re doing a WordPress update of the core, themes, or plugins, the site will automatically provide a simple 503 page. If you’re doing a series of updates, WordPress will go in and out of maintenance mode with each update, which isn’t ideal. The results could be inconsistent and unattractive till you’ve finished, especially if you’re changing the site’s appearance and not just updating software. It’s better to stay in maintenance mode till all the changes are done.
You can go into maintenance mode either manually or with a plugin. A plugin is easier to work with, unless you’re a PHP and file system geek. The appropriately named Maintenance plugin from Fruitful Code lets you create a custom 503 page while the site is offline. This page can include a nice image and give a useful message, such as “This site is getting a spectacular new look. Try again in half an hour.” You can set a login (different from the WordPress login) so you can view your changes to the site while it’s closed to the public.
Lots of maintenance-mode plugins are available, and more than one is called simply “Maintenance.” Make sure you get the one you’re looking for. They all do more or less the same thing but have different features. Some return an HTTP 200 code instead of a 503, so a search engine will see the page as a permanent change. Try to avoid those plugins.
When you turn on maintenance mode, you should deactivate any caching plugin. It could make it appear that the site is still online and give users outdated pages.
Paying attention to how your site responds while in maintenance mode will leave your viewers less confused and reduce the chance that search engines will stop listing it. This will mean more return visits when you’re back online.