How to Fix Common Rank Math Redirect Issues: A Troubleshooting Guide
Content
Rank Math SEO's redirection module is a powerful tool, but users often encounter specific problems when setting up complex rules. Based on common community reports, this guide addresses the most frequent redirect issues and their solutions.
Common Redirect Problems and Their Solutions
1. Redirecting URLs with Query Parameters
Problem: Redirecting URLs that contain specific query parameters (e.g., ?expand_domains=1) to a clean version without the parameter.
Solution: Use a Regex redirect rule in Rank Math.
- Source URL:
(.*)/?expand_domains=* - Destination URL:
https://www.yourdomain.com/$1 - Type: Regex
Important: To prevent a redirect loop, you may need to apply a custom filter code to your website. The Rank Math team provides a code snippet for this in their knowledge base under "Redirect Remove Query."
2. Redirecting After Changing Permalink Structures
Problem: Changing a site-wide permalink structure (e.g., from /%postname%/ to /%postname%1/) does not trigger automatic 301 redirects from the old URLs to the new ones.
Why it Happens: Rank Math's "Auto Post Redirect" feature only works when you change the slug of an individual post or page. It does not handle global changes to the permalink structure made in WordPress Settings > Permalinks.
Solution: You must manually create redirects for the old structure. For a site-wide change, this can be done with a single Regex rule.
- Source URL:
(.*) - Destination URL:
https://yourdomain.com/$11 - Type: Regex
Note: For complex migrations, a dedicated redirection plugin might be more effective.
3. Removing Category or Taxonomy Bases
Problem: You want to change a URL like /product-category/step-1/porcelain/ to /product-category/porcelain/ by stripping out a segment, or completely remove the base like /product-category/.
Solution: Use Regex redirects. The exact rule depends on your goal.
- To strip a middle segment (e.g., 'step-1'):
- Source URL:
product-category/step-1/(.*) - Destination URL:
https://yourdomain.com/product-category/$1 - Type: Regex
- Source URL:
- To remove the category base entirely (e.g., to change
/product-category/phones/to/phones/): Enable the "Remove Category Base" option in Rank Math's WooCommerce settings. If this causes a 404, you may need to create a manual redirect.- Source URL:
product-category/(.*) - Destination URL:
https://yourdomain.com/$1 - Type: Regex
- Source URL:
Limitation: The built-in "Remove Category Base" feature only works for standard and product categories. It cannot remove the base for custom taxonomies. For that, a permalink manager plugin is typically required.
4. Regex Redirects Not Working
Problem: You've created a Regex rule, but it doesn't trigger.
Why it Happens: Common causes include incorrect Regex syntax or a leading slash in the source URL.
Solution: Double-check your rule format.
- Ensure the "Match" type is set to "Regex" for the rule.
- Do not include a leading slash in the Source URL field. For example, use
product-category/(.*)instead of/product-category/(.*). - Test your rule with a few sample URLs to ensure the pattern matches correctly.
What Rank Math Redirects Cannot Do
It's important to understand the limitations of the plugin's redirection module to choose the right tool for the job.
- Domain-Level Redirects: Rank Math cannot redirect absolute paths between different domains (e.g., from
en.example.com/abouttoen.example.com/about-usin a multi-domain setup). This must be configured at the server level via.htaccess. - WWW/Non-WWW: Redirecting all traffic from a www version to a non-www version (or vice versa) is a server configuration task, not something handled within the plugin.
- Full Domain Change: Moving a site from one domain to another (e.g.,
site.comtosite.net) requires a server-wide 301 redirect, which should be set up by your hosting provider.
Final Checklist
- For query strings, use Regex and consider anti-loop filters.
- For permalink structure changes, create manual Regex rules.
- For category/taxonomy changes, use the built-in option if available, or craft a precise Regex rule.
- Always omit the leading slash in Source URLs for Regex rules.
- For server-level redirects (domains, www), contact your hosting support.
By following this guide, you should be able to resolve the majority of common redirection challenges encountered with the Rank Math SEO plugin.
Related Support Threads Support
-
How do you 301 multiple URLs?https://wordpress.org/support/topic/how-do-you-301-multiple-urls/
-
When a category name is suffix of domain name then the permalink is wronghttps://wordpress.org/support/topic/when-a-category-name-is-suffix-of-domain-name-then-the-permalink-is-wrong/
-
Inquiry About Removing Parent Slugs for Taxonomies and Attributeshttps://wordpress.org/support/topic/remove-bases-on-attributes/
-
How should we handle the category archive page after redirect?https://wordpress.org/support/topic/how-should-we-handle-the-category-archive-page-after-redirect/
-
Trailing slash on Homepagehttps://wordpress.org/support/topic/trailing-slash-on-homepage/
-
Slugs Being Renamed and Original Slug Redirected Using Elementor and RankMathhttps://wordpress.org/support/topic/slugs-being-renamed-and-original-slug-redirected-using-elementor-and-rankmath/
-
Redirection Errorhttps://wordpress.org/support/topic/redirection-error-17/
-
Configuring uniform permalink structure in wordpresshttps://wordpress.org/support/topic/configuring-uniform-permalink-structure-in-wordpress/
-
REST API do a redirecthttps://wordpress.org/support/topic/rest-api-do-a-redirect/
-
Pagination pages have canonical Urls as Homepagehttps://wordpress.org/support/topic/pagination-pages-have-canonical-urls-as-homepage/
-
Redirection of thousands of urls with parameter in the slughttps://wordpress.org/support/topic/redirection-of-thousands-of-urls-with-parameter-in-the-slug/
-
Problem with 301 redirect after change permalinkhttps://wordpress.org/support/topic/problem-with-301-redirect-after-change-permalink/
-
URL-s Are case sensitive shows 404 errorhttps://wordpress.org/support/topic/url-s-are-case-sensitive-shows-404-error/
-
How to Automate Redirectshttps://wordpress.org/support/topic/how-to-automate-redirects/
-
Attachment redirect stopped workinghttps://wordpress.org/support/topic/attachment-redirect-stopped-working/
-
Permalink change, how to setup auto 301 ?https://wordpress.org/support/topic/permalink-change-how-to-setup-auto-301/
-
redirect all AMP URLs back to the regular URLshttps://wordpress.org/support/topic/redirect-all-amp-urls-back-to-the-regular-urls/
-
If a category name contains suffix of domain name then permalink is wronghttps://wordpress.org/support/topic/if-a-category-name-contains-suffix-of-domain-name-then-permalink-is-wrong/
-
Automated Pagination Redirect Based on Product Availabilityhttps://wordpress.org/support/topic/automated-pagination-redirect-based-on-product-availability/
-
Moving to a different domainhttps://wordpress.org/support/topic/moving-to-a-different-domain-2/
-
Changing all urls at once and automatic 301 redirectionhttps://wordpress.org/support/topic/changing-all-urls-at-once-and-automatic-301-redirection/
-
redirect www and non-www versions to same urlhttps://wordpress.org/support/topic/redirect-www-and-non-www-versions-to-same-url/
-
Redirectshttps://wordpress.org/support/topic/redirects-60/
-
Why can’t I choose the same slug for category and product?https://wordpress.org/support/topic/why-cant-i-choose-the-same-slug-for-category-and-product/
-
URL Not redirecting automaticallyhttps://wordpress.org/support/topic/url-not-redirecting-automatically/
-
redirect to lenguage versionhttps://wordpress.org/support/topic/redirect-to-lenguage-version/
-
Custom taxonomy redirectionhttps://wordpress.org/support/topic/custom-taxonomy-redirection/
-
Every post image redirect to home page from image SERPhttps://wordpress.org/support/topic/every-post-image-redirect-to-home-page-from-image-serp/
-
Auto redirect after changing blog urls by setting permalinks to /blog/%postname%https://wordpress.org/support/topic/auto-redirect-after-changing-blog-urls-by-setting-permalinks-to-blog-postname/
-
home page indexed for every post instead of every post urlhttps://wordpress.org/support/topic/home-page-indexed-for-every-post-instead-of-every-post-url/
-
Configuring uniform permalink structure in wordpresshttps://wordpress.org/support/topic/configuring-uniform-permalink-structure-in-wordpress-3/
-
Redirect attachment to parent posthttps://wordpress.org/support/topic/redirect-attachment-to-parent-post/
-
Menu page permalink changes About and Find Us pages permalinkshttps://wordpress.org/support/topic/menu-page-permalink-changes-about-and-find-us-pages-permalinks/
-
Can we use RM to apply a 301 for *any* Sub Category URL to its parent?https://wordpress.org/support/topic/can-we-use-rm-to-apply-a-301-for-any-sub-category-url-to-its-parent/
-
Pages not indexed due to redirection on RankMath Sitemaphttps://wordpress.org/support/topic/pages-not-indexed-due-to-redirection-on-rankmath-sitemap/
-
Rank math redirect with amp pagehttps://wordpress.org/support/topic/rank-math-redirect-with-amp-page/
-
index url with double slash by googlehttps://wordpress.org/support/topic/index-url-with-double-slash-by-google/
-
Absolute path redirectionhttps://wordpress.org/support/topic/absolute-path-redirection/