Comment utiliser : .htaccess Tester & Validator
- Paste your
.htaccessfile (or click Test rules in the .htaccess generator). - Check the validation panel for errors that would cause a 500 error, and warnings for rules that never match.
- Enter a request URL to simulate it: each condition and rule is evaluated and the final redirect or rewrite is shown.
- List existing files and directories to test
-fand-dconditions.
What the validator checks
- Unknown directives and typos — Apache answers any unknown directive in .htaccess with a 500 Internal Server Error.
- Server-only directives such as
ServerName,<VirtualHost>or<Directory>, which are not allowed in .htaccess. - Unbalanced containers — an
<IfModule>or<FilesMatch>that is never closed. - Invalid regular expressions and unknown
RewriteRule/RewriteCondflags. - Logic problems: patterns starting with
^/(they never match in .htaccess), redirects withoutL, conditions with no rule, rules beforeRewriteEngine On. - Compatibility: Apache 2.2
Order/Allow/Deny,php_valueon PHP-FPM hosts, mixedOptionssyntax.
How the rewrite simulation works
Like Apache, the tester strips the leading slash from the path, evaluates each RewriteRule in order, checks its RewriteCond lines (with [OR] and [NC]), substitutes $1 and %1 back-references and server variables such as %{HTTP_HOST}, %{HTTPS}, %{REQUEST_URI} and %{QUERY_STRING}, and applies flags like R=301, L, QSA, F and G. After an internal rewrite it runs the rules again, just as Apache does in per-directory context. Redirect and RedirectMatch are tested too.
Limits
The simulator uses JavaScript regular expressions, which match PCRE for almost all .htaccess patterns. It cannot know your server’s file system (list files for -f/-d tests), RewriteMap, environment set by other modules, or the order in which mod_alias and mod_rewrite run on your server. Always confirm with a real request — the redirect checker shows the live redirect chain.
Build a new file with the .htaccess generator, and test the regular expressions in detail with the regex tester.
Aussi recherché comme : htaccess tester, htaccess validator, test rewrite rules, htaccess checker, mod_rewrite tester, htaccess syntax check, rewriterule tester.
Outils complémentaires : .htaccess Tester & Validator
- Htpasswd Generator — Generate user:hash lines for HTTP Basic Authentication in Apache, Nginx, Traefik and Caddy — with bcrypt by default and nothing sent to a server.
- HTTP Status Codes — Every standard HTTP response code explained in plain English, with when to use it and how it affects SEO.
- YAML Validator — Paste a Docker Compose file, Kubernetes manifest, GitHub Actions workflow or any YAML to pinpoint errors, catch common pitfalls and get a cleanly formatted version.
- Kubernetes YAML Generator — Fill in your app’s name, image and port and get production-ready Kubernetes YAML: a Deployment with probes, resource limits and a hardened security context, plus the Service, Ingress with TLS, ConfigMap, Secret and HorizontalPodAutoscaler you tick — in one file ready for kubectl apply.
Questions fréquentes
How do I find the line causing a 500 error?
Why does my RewriteRule ^/page$ never match?
^page$ instead of ^/page$.