Nginx Rewrite Checker
Evaluate rewrite rules in order and trace which line determines the final result.
Status
Runs in your browser. No input is sent to a server.
How to use
Enter path and rewrite/return lines, run simulation, then inspect trace and final transition.
Notes (this tool)
- This is a simplified model; verify location branching with the location matcher tool.
- A max-hop limit is applied to avoid infinite loops.
About this page
What does this tool do?
Simulates `rewrite` and `return` lines to visualize internal rewrites and external redirects.
Useful for first-pass diagnosis of loop risks, unexpected 301/302 responses, and missing rewrite conditions.
Supported directives (this implementation)
- `rewrite <regex> <replacement> [flag];`
- `return <code> [url];`
- flags: `last` / `break` / `redirect` / `permanent` (default `last`)
Notes
- This tool is a simplified rewrite-only model and does not include location branching or try_files behavior.
- Real runtime behavior can differ due to variables, subrequests, and module settings.
FAQ
Does this exactly match production Nginx behavior?
Not exactly. Validate production-specific behavior separately, including location selection, try_files, variables, and modules.
What should I check when unexpected 301/302 appears?
Check return directives, rewrite flags (redirect/permanent), rule order, and over-broad regex matches in that order.
Referenced specs
- Nginx rewrite module
- Nginx return directive
Next to view (diagnostic order)
These links are generated from site_map rules in recommended diagnostic order.
- Nginx Location Matcher — Estimate final location match from definitions and path
- Redirect Chain Inspect — Analyze redirect chains to detect loops and waste hops
- Location Inspect — Parse Location header and split destination URL
- HTTP Status Inspect — Analyze HTTP status codes and suggest handling direction
Same-theme links
Redirects
Use status codes and Location chains to isolate redirect issues
- HTTP Status Inspect — Analyze HTTP status codes and suggest handling direction
- Location Inspect — Parse Location header and split destination URL
- Nginx Location Matcher — Estimate final location match from definitions and path
- Redirect Chain Inspect — Analyze redirect chains to detect loops and waste hops