Skip to main content
HighConfigOWASP A05:2021CWE-538

How to fix: Raw Apache .htaccess File Served

The response body looks like a raw Apache .htaccess file (RewriteEngine/Options/<Files> directives) being served as a document instead of being processed as server configuration.

Why it matters

A leaked .htaccess file discloses internal rewrite rules, access restrictions, and directory structure, giving an attacker a map of paths and protections that were meant to stay server-side.

.htaccess is meant to be read and applied by Apache itself, never delivered as response content. Its presence in a response body means either the web server isn't configured to protect dotfiles, or a misconfigured static file handler is serving it.

How to fix it

  1. 1Add an explicit deny rule for .htaccess and other dotfiles in the web server configuration.
  2. 2Verify the file is not reachable at any path after the fix.
  3. 3Review .htaccess for any sensitive information it disclosed and rotate/adjust as needed.

Code examples

Apache: deny access to .htaccess

APACHE
<Files ".htaccess">
  Require all denied
</Files>

References

Detected automatically by VulnRadar. The check id is apache-htaccess-content-leaked, stable across every scan so you can filter or diff on it.

See every config check

Questions

How severe is Raw Apache .htaccess File Served?
VulnRadar rates this high severity in the config category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id apache-htaccess-content-leaked, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Raw Apache .htaccess File Served map to?
It maps to CWE-538. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for raw apache .htaccess file served

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Raw Apache .htaccess File Served | VulnRadar