How to hide the server version and X-Powered-By header on your site

To hide the server version and X-Powered-By header, set ServerTokens Prod in Apache, server_tokens off in Nginx, and expose_php Off in PHP. Those three settings stop your site announcing exactly which software and version it runs on every response.

How to fix5 min read

This is sensible hardening rather than a fix in its own right. Hiding a version number does not patch anything, but it does deny casual scanners a free shortlist of known issues to try against your exact release.

Our free external scan reads your live response headers and flags a server banner, an X-Powered-By value or a published WordPress version when it sees one, so you can confirm what you are leaking before and after you make the change.

What these headers actually leak

Every response your server sends carries headers, and a couple of them tend to say more than they need to. The Server header can read something like Apache/2.4.41 (Ubuntu), and X-Powered-By often reads PHP/7.4.3. WordPress can publish its own version on top.

On their own these values let nobody in. The concern is that a precise version string lets an attacker, or an automated scanner, match your software against published issues for that exact release without probing anything themselves.

  • Server: the web server name, often its full version and the operating system
  • X-Powered-By: usually the PHP version, sometimes a framework or hosting platform
  • WordPress version: published in page source, a generator meta tag or readme.html

How to hide the version banners (the three settings)

The change is configuration, not code. In each case you are telling the software to stop volunteering its version, then reloading or restarting the service so the new setting takes effect.

Apply the one that matches your stack, then re-test to confirm the banner has gone quiet.

  • Apache: set ServerTokens Prod, and ServerSignature Off, in the main config, then reload Apache
  • Nginx: set server_tokens off; in the http, server or location block, then reload Nginx
  • PHP: set expose_php Off in php.ini to drop the X-Powered-By: PHP header, then restart PHP-FPM
  • WordPress: remove the generator tag and delete or block readme.html so the core version is not published

Why this is defence-in-depth, not a cure

Hiding a version number changes nothing about whether that version is actually vulnerable. If you are running end-of-life PHP or an outdated server, the real fix is to update, not to hide the label.

Think of it as removing the signpost. A determined attacker can often still fingerprint your software through its behaviour, so treat suppressed banners as one quiet layer on top of patching, never a substitute for it. The headers you remove cost an attacker a little time; the updates you apply remove the actual risk.

Free, instant, no account

See your site's security grade in seconds.

Free, instant, and no account needed to see your grade.

Scan my site free

Plain-English A to E grade in about 10 seconds. No account needed to see it.

How our free check reports a leaked banner

When you run an EB Security scan, we read the headers your site already serves to any visitor and flag information disclosure where the Server banner, an X-Powered-By value or a published WordPress version is visible. The scan is passive and external: no logins, no probing, no exploitation.

This finding sits in the lower-severity, best-practice tier of your report. A leaked banner will nudge your grade and gives you a clear, named thing to tidy up, but it will not sink your score on its own. Critical items, like a broken or untrusted certificate or an exposed secret, are what hard-cap a grade, not a chatty header.

  • We read only what is public, exactly as any browser would see it
  • The finding comes with a plain-English explanation and the setting to change
  • Re-scan after applying ServerTokens Prod, server_tokens off or expose_php Off to confirm it is gone

A sensible order to work through

Suppressing banners is quick, so it is a fine early tidy-up. Just do it alongside the things that genuinely reduce risk, not instead of them.

A practical sequence keeps your effort pointed at what matters most while still closing the easy gaps.

  • First, update any end-of-life or outdated PHP, web server or WordPress core that a scan flags
  • Then hide the version banners with the three settings above
  • Then add the missing security headers, such as HSTS, CSP and X-Content-Type-Options
  • Finally, re-run a scan to confirm the changes landed and nothing else regressed

Hiding the server version and X-Powered-By header with ServerTokens Prod, server_tokens off and expose_php Off is quick, sensible hardening: it removes a free shortlist for scanners, but it is no substitute for actually patching outdated software.

Common questions

Does hiding the server version make my site secure?
No. It removes a useful clue for attackers and scanners, but it does not patch anything. If the underlying software is outdated, the real fix is to update it. Treat banner suppression as one quiet layer of defence-in-depth, not a cure.
How do I remove the X-Powered-By header in PHP?
Set expose_php Off in your php.ini, then restart PHP-FPM, or your web server, so it reloads. That stops PHP adding the X-Powered-By: PHP/x.y.z header. Some frameworks or hosting platforms add their own X-Powered-By value, which you remove separately in their own config.
What is the difference between ServerTokens and server_tokens?
They do the same job on different servers. ServerTokens Prod is the Apache directive that trims the Server header to just the product name. server_tokens off; is the Nginx equivalent, set in the http, server or location block. Use whichever matches your web server, then reload it.
Will hiding the WordPress version stop me being hacked?
It helps a little, but is not enough on its own. Removing the generator tag and blocking readme.html stops casual version fingerprinting, but the real protection is keeping WordPress core, plus your plugins and themes, fully up to date. Our free scan checks WordPress core version, readme and a couple of related exposures, not plugin or theme vulnerabilities.
Does the EB Security scan log in or probe the server to find the version?
No. It is a passive external scan. It reads only the headers and page source your site already serves publicly, so it sees the version banner exactly as any visitor would. It never logs in, brute-forces, fuzzes or exploits anything.
How much will hiding these banners improve my security grade?
A little. Information disclosure findings, like a server banner or an X-Powered-By value, sit in the best-practice tier and can nudge your grade, but they cannot sink it. Critical issues, such as a broken or expired certificate, an exposed secret or a Safe Browsing reputation hit, are what hard-cap a grade.

How safe is your website?

A free A to E grade in about 10 seconds. No account needed.

Check my site