-
Hi Rank Math team,
I’m currently trying to set up Regex-based redirects to remove old Shopify-style country prefixes like /de-de/, /fr-fr/, etc., from my URLs and redirect users to the correct path.
Example:
Redirect from:
/de-de/collections/all
To:
/collections/allI’ve added the following redirect in Rank Math:
Source URL: ^/de-de/(.*)
Destination URL: /$1
✅ Regex enabled
301 Permanent Move
Status: Active
I’ve also tried an exact match like:
Source: ^/de-de/collections/all/?$
Destination: /collections/all
Neither redirect works — I still get 404 pages, and the attempts do not appear in the Redirection log at all.
Here’s what I’ve already tried:
Verified the regex using regex101.com
Flushed permalinks (Settings → Permalinks → Save Changes)
Disabled caching plugins and cleared browser cache
Confirmed that basic non-regex redirects do work
It appears that Rank Math isn’t able to intercept these requests at all when regex is used — even for clearly matching routes. Could this be a known limitation? Or is there anything else I can do to ensure regex rules are actually triggered?
The ticket ‘Regex Redirection Not Working – Even for Simple Country Prefix Patterns’ is closed to new replies.