htaccess Tester
Paste your Apache .htaccess rules and test them against a URL path — validate RewriteRule patterns and debug redirects instantly.
What is a .htaccess File?
.htaccess is a per-directory configuration file used by the Apache web server. Placed in a folder, it applies its rules to that folder and everything beneath it, letting you change server behaviour without touching the main server config or restarting Apache. It is commonly used for URL rewriting, redirects, access control, custom error pages and caching headers. The leading dot makes it a hidden file on Unix systems, which is why it often does not appear in FTP clients by default.
How mod_rewrite Rules Are Evaluated
Rewriting is handled by mod_rewrite. A RewriteRule has a pattern, a substitution and optional flags. Patterns are regular expressions matched against the URL path with the leading slash removed. Any RewriteCond lines directly above a rule act as conditions on it, and by default multiple conditions are combined with AND. Rules run in order, top to bottom, and the output of one rule becomes the input to the next unless you stop the chain. The most common flags are [L] to stop processing further rules, [R=301] for a permanent redirect, [NC] for case-insensitive matching and [QSA] to preserve the existing query string.
Common Mistakes Worth Avoiding
Redirect loops are the classic failure, usually caused by a rule that rewrites a URL into something that matches the same rule again — guard against it with a RewriteCond that excludes the target. Testing with R=301 too early is another trap, because browsers cache permanent redirects aggressively; use R=302 while iterating and switch to 301 once the rule is proven. Also remember that .htaccess is read on every single request, so very large rule sets carry a real performance cost. If you control the main server config, rules placed there are faster. Finally, .htaccess only works if AllowOverride permits it — on some hosts it is disabled entirely and your file will be silently ignored.
Frequently Asked Questions
What is an htaccess tester?
An htaccess tester lets you paste your Apache .htaccess rules and test how they behave against a URL path — without uploading to a server. It's useful for debugging RewriteRule patterns and redirect logic before deploying.
How do I test a RewriteRule without a server?
Paste your RewriteRule lines into the tester above and enter the URL path you want to test. The tool evaluates the regex pattern and shows whether it matches and what the rewritten URL would be.
What does the [L] flag mean in htaccess?
The [L] flag stands for Last — it stops processing further RewriteRules once a match is found. Without [L], Apache continues checking subsequent rules even after a match.
Why is my .htaccess file being ignored?+
The most common reason is that AllowOverride is set to None for that directory in the Apache configuration, which disables .htaccess entirely. Other causes include the file being named incorrectly (it must be exactly .htaccess with no extension), wrong file permissions, or the site running on Nginx, which does not use .htaccess at all.
What is the difference between a 301 and a 302 redirect?+
A 301 is permanent and tells search engines to transfer ranking signals to the new URL and update their index. A 302 is temporary and leaves the original URL indexed. Browsers cache 301 responses aggressively, so use 302 while testing and only switch to 301 once you are certain the destination is correct.
What does the [L] flag actually do?+
It stops mod_rewrite from processing any further rules for the current pass. It does not necessarily end all rewriting, because in .htaccess context the rewritten URL can be fed back through the ruleset again. This is why a rule with [L] can still cause a loop if the result matches the same pattern.
Does .htaccess work on Nginx?+
No. .htaccess is an Apache feature. Nginx has no per-directory configuration equivalent, and its rewrite rules use different syntax defined in the server configuration. Rules must be converted manually and the server reloaded for changes to take effect.
Will a large .htaccess file slow down my site?+
It can. Apache reads and parses .htaccess on every request, and for every parent directory in the path. A handful of rules is negligible, but hundreds of rules add measurable latency. If you have access to the main server configuration, moving rules there removes the per-request parsing cost.