Regex, prefix, 410 and 451 redirects
Redirect whole folders with Starts with matching, rewrite URLs with regular expressions, and return 308, 410 Gone or 451 status codes with RankKit SEO Pro.
On this page
RankKit SEO Pro This feature is part of RankKit SEO Pro. Start a 14-day free trial or see plans.
The free redirect manager matches one exact path per rule. That's fine for a few moved pages, but not when you restructure a site: moving /blog/ to /articles/, changing a date-based permalink structure, or retiring a whole product line. RankKit SEO Pro adds two match types and three status codes for those jobs.
You set them in the same form: RankKit SEO → Redirects → Add redirect, using the Match and Type fields.
Match types
| Match | What it does | Example |
|---|---|---|
| Exact path | One path, ignoring case and a trailing slash. | /old-page |
| Starts with | The path and everything below it. | /old matches /old and /old/page, but not /older-post |
| Regular expression | A PCRE pattern, case-insensitive. "Use $1, $2 for captured groups." | ^/blog/(\d+)/(.*)$ |
When more than one rule could match a request, exact rules win over Starts with rules, and Starts with rules win over regular expressions.
Starts with: move a whole folder
| From | To | Result |
|---|---|---|
/blog |
/articles/ |
/blog/my-post goes to /articles/my-post |
/blog |
/articles |
Every URL under /blog goes to /articles |
If the To URL ends with a slash, the rest of the requested path is added to it. Without the trailing slash, everything goes to the one target.
Regular expression: rewrite URLs
Use parentheses to capture parts of the old path and $1, $2 to place them in the target.
| From | To | Result |
|---|---|---|
^/blog/(\d+)/(.*)$ |
/articles/$2 |
/blog/2021/my-post goes to /articles/my-post |
^/product/(.*)-old$ |
/shop/$1 |
/product/blue-mug-old goes to /shop/blue-mug |
^/category/(.*)$ |
/topics/$1 |
Every category URL moves to /topics/ |
The pattern is tested against the path only, without the domain or query string. Anchor it with ^ and $: without them it can match in the middle of a path, and only the matched part is replaced. An invalid pattern is rejected with "The regular expression is not valid."
Important A broad pattern can catch more URLs than you meant, including your own pages. Test a new regex rule on a few real URLs right after saving. An AI agent can do this for you with the
test_urltool, which shows which rule matches a URL.
Status codes
| Type | When to use it |
|---|---|
| 308 Permanent redirect (keeps method) | A permanent move where the request method must be kept, for example an endpoint that receives form posts. |
| 410 Gone | The page was removed on purpose and won't come back. Search engines drop a 410 faster than a 404. Needs no target. |
| 451 Unavailable for legal reasons | The page was removed because of a legal demand. Needs no target. |
410 and 451 rules return the status code with an empty page instead of redirecting. Combine them with Starts with or a regular expression to retire a whole section at once, for example From /discontinued/, Match Starts with, Type 410 Gone.
Imported rules
When you import redirects from Redirection, Rank Math or Yoast SEO Premium, prefix and regex rules come across on Pro. The free plugin imports exact-match rules only.
FAQ
What happens to my regex and 410 rules if Pro expires?
They stay in your list and keep running, but you can't create or edit rules of these kinds without Pro. Exact-match 301, 302 and 307 rules work as before.
Should I use 410 or a redirect for deleted pages?
Redirect when there's a close replacement, such as a newer version of the product or article. Use 410 when there's nothing relevant to send people to. Redirecting everything to the home page is treated by Google as a soft 404.
Do regex rules slow the site down?
Each request first checks exact rules in one lookup, then Starts with rules, then regular expressions. A few dozen patterns cost very little. If you have hundreds, prefer Starts with rules where they do the job.
Was this page helpful?
Related guides
Create and manage redirects
Send old URLs to new ones with 301, 302 and 307 redirects in RankKit SEO, with hit counts, search, automatic slug-change redirects and one-click undo.
404 monitor and catch-allPRO
Log every missing URL visitors and bots hit, redirect each in a click, and send the rest to a page you choose with the 404 catch-all in RankKit SEO Pro.
Import redirects from Redirection and other plugins
Import redirects into RankKit SEO from Redirection, Rank Math, Yoast SEO Premium, Squirrly SEO or another RankKit SEO site, with backup and one-click undo.
Still need help?
Email us with your WordPress and RankKit SEO versions and what you tried. Pro customers get priority replies.