Paste your Apache .htaccess rules and test them against a URL path — validate RewriteRule patterns and debug redirects instantly.
.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.
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.
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.