Esta página ainda não foi traduzida para o português, por isso aparece em inglês.

.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.

Atualizado em

Test a URL

Validation

Seus dados nunca saem do seu computador. Todo o processamento acontece localmente no navegador.

Como usar: .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.

Também pesquisado como: htaccess tester, htaccess validator, test rewrite rules, htaccess checker, mod_rewrite tester, htaccess syntax check, rewriterule tester.

Ferramentas que combinam com: .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.

Perguntas frequentes

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.
Posso instalar o .htaccess Tester & Validator como um aplicativo da web e usá-lo offline?
Sim. O .htaccess Tester & Validator é um aplicativo da web instalável (PWA) — instalado a partir do seu navegador, não baixado de uma loja de aplicativos. Clique em “Instalar aplicativo” na parte superior desta página no Chrome ou no Edge (Windows, macOS, Linux, ChromeOS) ou, no Android, use “Compartilhar” → “Adicionar à tela inicial” no iPhone e no iPad, ou “Arquivo” → “Adicionar ao Dock” no Safari 17+ em um Mac. Em seguida, ela se abre em uma janela própria com seu próprio ícone e, como é executada inteiramente no seu navegador, continua funcionando offline. O Firefox no desktop não permite a instalação de aplicativos da web. Como funciona a instalação.

Ferramentas relacionadas