⚡ WordPress · Client-side · No data sent to server

Rewrite Rules Explainer

Paste a WordPress rewrite rule and get a plain-English breakdown of every regex token, capture group, and query var. Test a URL against the pattern. Runs entirely in your browser.

Paste any regex from WordPress rewrite rules, add_rewrite_rule(), or .htaccess.
100% private. The pattern is parsed and tested with your browser's native RegExp engine. Nothing is uploaded or logged.

About the Rewrite Rules Explainer

The Rewrite Rules Explainer turns a WordPress rewrite rule into a plain-English breakdown. Paste a regex pattern from add_rewrite_rule(), the rewrite_rules option, or your .htaccess, and the tool labels every token, lists each capture group, and shows the $matches variables they feed into the index.php target. It is built for WordPress developers debugging permalinks, custom post type routes, and REST endpoints. Everything runs in your browser using the native RegExp engine, so nothing is uploaded.

How it works

  1. Paste a rewrite rule regex into the input, or click one of the common WordPress examples to load it.
  2. Click Explain. The tool tokenises the pattern and describes each anchor, capture group, character class, and quantifier.
  3. Read the Query Vars section to see what each $matches[n] holds and how to reference it in the rewrite target.
  4. Type a sample URL path in the Test box to confirm whether it matches and see the captured values.

Features

  • Token-by-token breakdown with color-coded labels for anchors, groups, classes, quantifiers, and literals.
  • Capture group to $matches mapping, the way WordPress passes values into the index.php target.
  • Live URL tester that shows match status and every captured value.
  • Seven ready-to-load examples covering slugs, paging, date permalinks, feeds, and the REST API.
  • Invalid patterns are caught and reported instead of failing silently.

Frequently asked questions

What is a WordPress rewrite rule?

A rewrite rule is a pair: a regex pattern matched against the URL path and a rewrite target like index.php?p=$matches[1]. WordPress stores these in the rewrite_rules option and uses them to map pretty permalinks to query variables.

What does $matches[1] mean?

Each parenthesised capture group in the pattern is numbered left to right. The text a group captures becomes $matches[1], $matches[2], and so on, which the rewrite target passes into index.php as query variables.

Where do I find my rewrite rules?

They come from core, your theme, and plugins via add_rewrite_rule() and related functions. You can dump the full list with WP-CLI using wp rewrite list, or read the rewrite_rules row in the wp_options table.

Does the URL tester behave exactly like WordPress?

It runs your pattern with the browser's RegExp engine, which uses the same regex syntax WordPress passes to PCRE for these rules. It is accurate for matching and capture, but it does not run the full WordPress rewrite pipeline, so rule order and query var registration are not simulated.

Is my data sent anywhere?

No. Parsing, explaining, and testing all happen in your browser. The pattern and test URLs never leave your device and are not logged.