Custom URL redirects (301/302) in WordPress
Redirects maintains a simple rules table — source path, target path and redirect type. It also supports regular expressions with backreferences, so a single rule can redirect an entire renamed section of your site.
Key features
- A simple rules table showing hit counts for each rule
- Supports both 301 (permanent) and 302 (temporary) redirects
- Regular expressions (PCRE) with backreferences in the target ($1, $2...)
- Its own indexed DB table — the lookup doesn’t hurt performance even on high-traffic sites
- Connected to the Monitor 404 module — create a redirect straight from a detected 404 in a couple of clicks
How it works
The check runs on `template_redirect`, i.e. after core’s own redirect (`redirect_canonical`) but before the 404 page renders. An exact match is tried first, then regular expression rules.
For regex rules, `preg_match()` verifies the match and `preg_replace()` resolves the backreferences in the target directly — so a rule like `^/novinky/(.+)$` → `/aktuality/$1` redirects `/novinky/nazev-clanku` to `/aktuality/nazev-clanku` with no manual substitution code needed.
An alternative to Redirection or Safe Redirect Manager for sites that just need a simple rules table without extra unnecessary logging.