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
- 1Add an explicit deny rule for .htaccess and other dotfiles in the web server configuration.
- 2Verify the file is not reachable at any path after the fix.
- 3Review .htaccess for any sensitive information it disclosed and rotate/adjust as needed.
Code examples
Apache: deny access to .htaccess
<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.
More config checks
- MediumNo Rate-Limit Policy Detected
- MediumVary: Cookie Missing on Cookie-Bearing Response
- LowSet-Cookie Header Exceeds 4 KB
- LowVary Header Missing on Compressed Responses
- InfoDownloadable Content Served as inline
- InfoX-XSS-Protection Header Is Deprecated
- LowServer-Timing Exposes Cache Timings
- LowVary: Cookie on Static Resource
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.