PHP2Shell (CVE-2026-109618 / CVE-2026-109619) is a critical security problem in PHP itself that lets attackers take over web servers. Every website that runs PHP should be updated to 8.5.12, 8.4.27, 8.3.36, 8.2.35 or newer as soon as possible. Read our PHP2Shell check and patch guide.
Sometimes the safest thing to do with a website is to switch it off until it has been patched. That was the official advice from several governments when the PHP2Shell flaws were announced in October 2026. Switching a website off the wrong way can cost you search rankings, though, so it is worth taking five minutes to do it properly.
The key is the HTTP status code your server sends while the website is down. A 503 Service Unavailable status tells Google and other search engines that the website is temporarily unavailable and that they should come back later. Almost every other way of taking a website offline sends a signal that can lead to your pages being dropped from search results.
On the day the PHP2Shell fixes came out, Google Search Central reminded website owners that serving a 503 keeps already indexed pages in Google Search while the work is being done. Google's John Mueller added that the 503 is best served from outside PHP, for example by the web server itself or by a CDN, so that the vulnerable code isn't running at all.
Google also warns that a 503 is only a short-term measure. If it keeps seeing a 503 for the same address for more than a day or two, it may start dropping that page from its index anyway.
Retry-After: 7200 means two hours) or as a date and time in UTC.Create a plain HTML file called maintenance.html in your website's root folder with a short message for visitors, then add these lines to the top of your .htaccess file. Replace the example IP address with your own.
# Temporary maintenance: everyone except you gets a 503
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^203\.0\.113\.10$
RewriteCond %{REQUEST_URI} !^/(maintenance\.html|robots\.txt)$
RewriteRule ^ - [R=503,L]
ErrorDocument 503 /maintenance.html
Header always set Retry-After "7200" "expr=%{REQUEST_STATUS} == 503"
The Header line needs Apache's mod_headers module, which almost every host has turned on. Delete the whole block once the website has been patched.
Put your maintenance.html file in a folder of its own, such as /var/www/maintenance, and replace the location / block in your website's server configuration with the following. Then reload Nginx with sudo nginx -t && sudo systemctl reload nginx.
error_page 503 /maintenance.html;
location = /maintenance.html {
root /var/www/maintenance;
add_header Retry-After 7200 always;
internal;
}
location = /robots.txt { }
location / {
if ($remote_addr != 203.0.113.10) {
return 503;
}
try_files $uri $uri/ /index.php?$args;
}
Because the 503 is returned before any request is passed to PHP-FPM, you can also stop PHP-FPM completely while you work, which is the safest option of all.
If your website runs on IIS with the URL Rewrite module, add this rule at the top of the <rules> section of your web.config file:
<rule name="Temporary maintenance 503" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REMOTE_ADDR}" pattern="^203\.0\.113\.10$" negate="true" />
<add input="{URL}" pattern="^/robots\.txt$" negate="true" />
</conditions>
<action type="CustomResponse" statusCode="503" statusReason="Service Unavailable" statusDescription="Down for a short security update" />
</rule>
If your website sits behind Cloudflare, you can serve the 503 from Cloudflare's network so that requests never reach your server at all. Create a Worker with the code below and add a route for your domain (for example example.com/*). Remove the route when you're back online.
export default {
async fetch(request) {
const url = new URL(request.url);
if (url.pathname === "/robots.txt") {
return fetch(request);
}
return new Response(
"<!doctype html><title>Back soon</title><h1>We'll be back shortly</h1><p>We're installing an urgent security update.</p>",
{ status: 503, headers: { "Content-Type": "text/html; charset=utf-8", "Retry-After": "7200" } }
);
}
};
Other CDNs, such as Fastly, Bunny and Akamai, offer similar edge rules or maintenance modes. Whichever you use, check that it returns a 503 status code and not a 200.
From a computer that isn't on your allowed IP address, ask for the headers of your home page:
curl -I https://example.com/
The first line should show 503 and the response should include a Retry-After header. Then check that curl -I https://example.com/robots.txt still returns 200.
curl -I that your pages return 200 again.For more on how server errors affect search, see our guide to PHP errors and Google crawling. If your website was online while it was vulnerable, it is also worth checking that it wasn't attacked, as described in our guide to hacked PHP websites and Google rankings.
Back to PHP Security Alerts