Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

.htaccess Tester & Validator

Find the line that causes a 500 error and test rewrite rules before you deploy: enter a URL to see which conditions match, where it redirects or what it rewrites to.

Mis à jour le

Test a URL

Validation

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : .htaccess Tester & Validator

  1. Paste your .htaccess file (or click Test rules in the .htaccess generator).
  2. Check the validation panel for errors that would cause a 500 error, and warnings for rules that never match.
  3. Enter a request URL to simulate it: each condition and rule is evaluated and the final redirect or rewrite is shown.
  4. List existing files and directories to test -f and -d conditions.

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 / RewriteCond flags.
  • Logic problems: patterns starting with ^/ (they never match in .htaccess), redirects without L, conditions with no rule, rules before RewriteEngine On.
  • Compatibility: Apache 2.2 Order/Allow/Deny, php_value on PHP-FPM hosts, mixed Options syntax.

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?
Paste the file here: unknown directives, server-only directives, unclosed tags and invalid regular expressions are listed with their line numbers. On the server, Apache’s error log names the line too.
Why does my RewriteRule ^/page$ never match?
In .htaccess the path is matched without the leading slash. Use ^page$ instead of ^/page$.
Is the simulation exactly like Apache?
It follows Apache’s per-directory rewrite logic for the common directives and flags, but cannot see your file system or other modules. Treat it as a fast check and confirm with a live request.
Is my .htaccess uploaded?
No. Validation and simulation run in your browser.
Puis-je installer .htaccess Tester & Validator en tant qu’application web et l’utiliser hors ligne ?
Oui. .htaccess Tester & Validator est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires