Apache rewrite rule tester
Run your .htaccess or virtual host rewrite rules against test URLs and see the redirect, internal rewrite or error each one gets, with every rule and condition that matched.
Up to 200,000 characters of rules, 2,000 rules and 200 test URLs. Everything runs on your device in a background worker. Downloads: a plain text trace, a JSON report with every step and a CSV of results. Paste the rewrite lines from .htaccess or your virtual host. Up to 200,000 characters. Review the settings before running.
Your result
How to use Apache rewrite rule tester
- Paste the RewriteEngine, RewriteBase, RewriteCond and RewriteRule lines.
- Add test URLs, one per line, and choose whether the rules live in .htaccess or the server configuration.
- List files and folders that exist if your conditions use -f or -d.
- Run the test and read the trace, or download the JSON report and CSV.
Useful next steps
How the rules are run
Happytails.ai interprets the rules following the Apache HTTP Server 2.4 mod_rewrite documentation (httpd.apache.org, read on 16 October 2026). In .htaccess the folder prefix is removed before matching and added back to relative results, RewriteBase applies, and after an internal rewrite the rules run again, up to 10 rounds like LimitInternalRecursion. In the server configuration each URL goes through the rules once. The query string is kept unless the substitution brings its own, QSD is set or the substitution ends with ?, and QSA adds the old query to a new one. An absolute URL with the same scheme, host and port as the request is served internally, as when ServerName names that port; any other absolute URL is a redirect, 302 unless R gives a code. Redirect locations are escaped the way Apache escapes them unless NE is set.
Conditions, references and flags
RewriteCond supports regular expressions, negation with !, lexical and number comparisons, [NC] and [OR]. As in Apache, a chain of [OR] conditions stops at its first true condition. Substitutions expand $1 from the rule, %1 from the last matching condition and %{VARIABLE} values such as HTTPS, HTTP_HOST, REQUEST_URI and QUERY_STRING. The flags L, END, R, NC, QSA, QSD, QSL, NE, F, G, C, S, N, PT, P, E, B, BNP, BCTLS and BNE are applied, including several E flags on one rule with references in their values.
Limits
Apache uses PCRE and this page uses JavaScript regular expressions. Most patterns behave the same; patterns with possessive quantifiers, atomic groups, \A, \Z or inline flags are reported instead of guessed. RewriteMap, other modules such as mod_alias, and the real file system are not available, so -f and -d use the paths you list.