Skip to content

Everything for WordPress, web development — and beyond

.htaccess audit: 500 errors, dead directives, signs of a compromise

.htaccess audit: why the site returns 500 and which rules do not work

Drop the file in — the tool will find the BOM, dead directives, rules with a high risk of a 500 error and signs of outside tampering. The file is read in your browser and is not sent anywhere.

Byte-level checks — BOM, CRLF, non-printing and invisible characters — are possible only for a file. When you paste from the clipboard the browser has already stripped them, so the most common cause of a 500 becomes invisible.
The analysis starts automatically. The file is not sent anywhere — your browser reads it.
Context

A clean .htaccess does not cure a hack. If the site is compromised, the malicious code lives in PHP and .htaccess is only its consequence: the dropper will rewrite the file back within minutes of your cleaning it. The order of work is the reverse — first find the executable code, then tidy up the config.

The file is read in your browser — its contents are never sent anywhere and never stored.

Why a file rather than pasted text

The most common cause of a 500 error after editing .htaccess is not visible in the text at all. It is the BOM — three invisible bytes at the start of the file, added by Windows Notepad when saving as UTF-8. Apache treats them as part of the first directive and cannot parse it. That is why the tool takes the file itself: only that way can the bytes be read and the BOM, the Windows-style line endings and the invisible characters inside lines be spotted. The second group of problems is directives that do nothing but look functional. mod_gzip_on is Apache 1.3 syntax; on modern servers it is silently ignored while people spend years believing compression is on. An ExpiresByType block wrapped in a check for mod_headers.c instead of mod_expires.c will not work either — and without a hint you will not notice. Third come php_value and php_flag. They work only when PHP is loaded as an Apache module. On modern hosting with PHP-FPM such a line is either ignored or produces a 500 straight away. And security separately: if the file contains rules that redirect visitors depending on which search engine they came from, or hide the redirect from the administrator, that is a classic sign of compromise. But a clean .htaccess does not cure a hack: almost always a PHP script lives somewhere in the files and will write it back.

Frequently asked questions