{"id":5796,"date":"2026-08-13T20:33:41","date_gmt":"2026-08-13T12:33:41","guid":{"rendered":"https:\/\/www.6ebook.com\/?p=5796"},"modified":"2026-08-13T20:38:59","modified_gmt":"2026-08-13T12:38:59","slug":"woocommerce-product-permalink-301-rank-math","status":"publish","type":"post","link":"https:\/\/www.6ebook.com\/en\/woocommerce-product-permalink-301-rank-math\/","title":{"rendered":"A Practical Guide to WooCommerce Product URL Rewriting: Using Rank Math for Bulk 301 Redirects and Fixing Product Category Redirects to the Home Page"},"content":{"rendered":"<p class=\"wp-block-paragraph\">While performing maintenance on a WooCommerce website for an international trade company, we needed to redesign the URLs for product details and product categories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The original product detail link was previously used incorrectly by the client using the following structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/Product-Categories\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The plan has been revised to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/product\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At the same time, the original product category links in WooCommerce:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/product-category\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We also plan to change it to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/products\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To protect customer information, this article consistently uses <code>example.com<\/code> Use these as placeholders for the actual domain names, but retain the actual link structure, Rank Math configuration, and troubleshooting process used in this project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the surface, this is simply a matter of standardizing two URL prefixes, but since the website is already live and some products and product categories have already been indexed by Google, this actually constitutes a minor <strong>URL Migration<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Throughout this process, the issues to be addressed go beyond simply \u201cwhere to edit the permalinks\u201d and also include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How should existing URLs that have already been indexed be handled?;<\/li>\n\n\n\n<li>The website has a large number of products. Do I need to set up 301 redirects for each one individually?<\/li>\n\n\n\n<li>How to ensure that old products are correctly mapped to their corresponding new products;<\/li>\n\n\n\n<li>How to Avoid Redirect Chains and Incorrect Redirects;<\/li>\n\n\n\n<li>Why does Rank Math redirect some product categories to the homepage?;<\/li>\n\n\n\n<li>What SEO follow-up tasks need to be completed after the revisions are finished?<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Below is a complete walkthrough of the process of restructuring the WooCommerce product URLs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Objectives of This WooCommerce URL Refactoring<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The final link structure has been determined as follows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Content Type<\/th><th>Original URL Structure<\/th><th>New URL Structure<\/th><\/tr><\/thead><tbody><tr><td>Product Details<\/td><td><code>\/Product-Categories\/product-slug\/<\/code><\/td><td><code>\/product\/product-slug\/<\/code><\/td><\/tr><tr><td>Product Categories<\/td><td><code>\/product-category\/category-slug\/<\/code><\/td><td><code>\/products\/category-slug\/<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4ea7\u54c1\u8be6\u60c5\uff1a\n\/product\/2-ethyl-3-5-dimethylpyrazine\/\n\n\u4ea7\u54c1\u5206\u7c7b\uff1a\n\/products\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The singular form is used here for <code>\/product\/<\/code> To refer to specific products, use the plural form of <code>\/products\/<\/code> This refers to product catalogs or product categories, making it easier for both visitors and website administrators to understand.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WooCommerce itself also treats \u201cProduct Permalinks\u201d and \u201cProduct Category Prefix\u201d as two separate sets of settings. By default, product details typically use <code>\/product\/product-name\/<\/code>, while product categories use <code>\/product-category\/category-name\/<\/code>, Both can be modified in WordPress's permalink settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Google recommends that websites use URLs that are logically structured, easy to understand, and descriptive. However, making URLs shorter or more aesthetically pleasing does not necessarily mean that rankings will improve. The primary value of this change is to unify the information architecture, eliminate semantic confusion in the original paths, and establish a more stable URL convention for future website maintenance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Can I still edit a URL that has already been indexed by Google?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can make the change, but you must treat it as a formal URL migration\u2014not just a matter of updating the permalinks in the admin panel and calling it a day.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Google treats path variations within the same website, such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/example-old-path\/page\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/example-new-path\/page\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This also falls under \u201cwebsite migration with URL changes.\u201d Google recommends establishing a mapping between the old and new URLs before the migration and using server-side permanent redirects to point the old URLs to their corresponding new URLs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For permanent URL changes, you should use:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>301 Moved Permanently\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>308 Permanent Redirect\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In typical WordPress and Rank Math use cases, a 301 redirect is the most common and appropriate choice. Google also recommends using server-side 301 or 308 redirects for permanent redirects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please note:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Just because a URL has already been indexed doesn\u2019t mean it can never be changed, but you shouldn\u2019t change it frequently just to make it \u201clook nicer.\u201d<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">If the old URL has a clear structure, has been stable over the long term, and has good search rankings and backlinks, the need to change it should be carefully evaluated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this case study, the legacy product path <code>\/Product-Categories\/<\/code> Although it actually displays a single product detail page, it uses a name like \u201cProduct Categories\u201d and includes uppercase letters\u2014this clearly indicates a problem with the information architecture, so it\u2019s worth revising it once and for all to a more reasonable structure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Things to Confirm Before Making Changes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before proceeding with the actual operation, we recommend that you complete the following preparations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Verify that the product and category slugs do not change<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The bulk redirection solution in this tutorial is suitable for:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u53ea\u4fee\u6539 URL \u524d\u7f00\n\u4ea7\u54c1\u6216\u5206\u7c7b\u81ea\u8eab\u7684 slug \u4fdd\u6301\u4e0d\u53d8\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/abc\/\n\u2192 \/product\/abc\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/flavors\/\n\u2192 \/products\/flavors\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the product slug also changes, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/old-product-name\/\n\u2192 \/product\/new-product-name\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Since the standard regex rules cannot automatically determine the correspondence between the two, these links require the creation of separate, precise one-to-one redirects.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Back up the website and preserve the old URLs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before making any changes, you should at least back up the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>WordPress database;<\/li>\n\n\n\n<li>Website files;<\/li>\n\n\n\n<li>Rank Math Redirect Settings;<\/li>\n\n\n\n<li>Current XML Sitemap;<\/li>\n\n\n\n<li>URLs for Key Products and Product Categories.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For websites with a large number of products, you can export existing URLs from Rank Math Sitemap, Google Search Console, the website\u2019s crawl tool, or the database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Google also recommends organizing the old URLs before migrating them and establishing mappings from the old URLs to the new ones.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Check for conflicts with the new URL prefix<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This case study was ultimately used for:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4ea7\u54c1\u8be6\u60c5\uff1a\/product\/\n\u4ea7\u54c1\u5206\u7c7b\uff1a\/products\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not set both product details and product categories to use the same prefix. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4ea7\u54c1\u8be6\u60c5\uff1a\/products\/\n\u4ea7\u54c1\u5206\u7c7b\uff1a\/products\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">WooCommerce explicitly states that the product custom base and the taxonomy permalink base must be unique; otherwise, WordPress may not be able to distinguish between product detail pages and product category pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the website already has a URL that is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/products\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The Products page should also be tested in advance:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/\n\/products\/category-slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify that both the product overview page and the product category page render correctly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Avoid making too many major changes at the same time<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">During the URL migration, it is not recommended to perform the following actions simultaneously:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Change the domain name;<\/li>\n\n\n\n<li>Change servers;<\/li>\n\n\n\n<li>Change the theme;<\/li>\n\n\n\n<li>Change the multilingual scheme;<\/li>\n\n\n\n<li>Making large-scale changes to page content;<\/li>\n\n\n\n<li>Replace the SEO plugin at the same time;<\/li>\n\n\n\n<li>Adjust the HTTPS, www, or non-www versions at the same time.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Otherwise, if there are any anomalies in traffic, search rankings, or backlinks, it will be difficult to determine exactly which change caused the issue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Modify WooCommerce Product Permalinks<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>WordPress \u540e\u53f0\n\u2192 \u8bbe\u7f6e\n\u2192 \u56fa\u5b9a\u94fe\u63a5\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Scroll down to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4ea7\u54c1\u56fa\u5b9a\u94fe\u63a5\nProduct permalinks\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Select:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u81ea\u5b9a\u4e49\u7ed3\u6784\nCustom base\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fill in:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After saving, the product details URL will change from:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">According to the official WooCommerce documentation, for non-plain permalinks, products can use the following by default: <code>\/product\/product-name\/<\/code>, or you can customize the product base.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Modify the product category prefix<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Still at:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u8bbe\u7f6e\n\u2192 \u56fa\u5b9a\u94fe\u63a5\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Find the following in the \u201cOptional\u201d section:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4ea7\u54c1\u5206\u7c7b\u76ee\u5f55\u524d\u7f00\nProduct category base\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The default settings for WooCommerce are usually:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>product-category\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change it to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>products\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After saving, the original product category URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Will become:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">WooCommerce has officially confirmed that,<code>product-category<\/code> This is the default product category base, and it can be customized in the permalink settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is important to note that modifying the product category prefix primarily determines:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/category-slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Don't assume that:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It will automatically become a complete Product Center page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you need a separate \"Products\" page in your site navigation, you should check whether that page is a standard WordPress page, a WooCommerce Shop page, or a product archive page generated by the theme template.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Check Rank Math\u2019s WooCommerce URL settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to WordPress permalinks, Rank Math also offers several features that rewrite WooCommerce URLs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 General Settings\n\u2192 WooCommerce\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Key Areas to Inspect:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Remove Base\nRemove Category Base\nRemove Parent Slugs\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the goal is to explicitly retain:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product\/product-slug\/\n\/products\/category-slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We recommend that you first disable the following during the migration:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Remove Base\nRemove Category Base\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you enable \"Remove Base,\" Rank Math may continue to remove the fixed prefix from product URLs; if you enable \"Remove Category Base,\" it may also continue to remove paths related to product categories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">During the migration, you should ensure that a single entity is responsible for the URL structure as much as possible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In other words:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>WooCommerce \u56fa\u5b9a\u94fe\u63a5\n\u8d1f\u8d23\u786e\u5b9a\u6700\u7ec8 URL\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At this stage, Rank Math is primarily responsible for:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7 URL \u5230\u65b0 URL \u7684 301\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not enable multiple \u201cRemove Prefix\u201d or \u201cSimplify URL\u201d features at the same time, as this may result in:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The actual URL does not match the expected one;<\/li>\n\n\n\n<li>Secondary redirection;<\/li>\n\n\n\n<li>Redirect loop;<\/li>\n\n\n\n<li>Conflicts between products and category paths;<\/li>\n\n\n\n<li>Some pages return a 404 error.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If the website has parent-child product categories, you should also confirm whether you plan to retain the parent category slug.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/natural-flavors\/acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If \"Remove Parent Slugs\" is enabled, it might look like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will affect how the Regex redirects are mapped. According to Rank Math\u2019s official documentation, \u201cRemove Parent Slugs\u201d removes the parent category portion from subcategory URLs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Use Rank Math Regex to Set Up 301 Redirects in Bulk<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After setting up the new permalinks, you'll need to set up a permanent redirect from the old URLs to the new ones.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 Redirections\n\u2192 Add New\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you don't see the \"Redirections\" menu, you'll need to first go to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 Dashboard\n\u2192 Modules\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Redirections\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For some advanced options, you'll also need to switch Rank Math to Advanced Mode.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Product Details: Batch 301 Rules<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The old product structure was:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/product-slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The new structure is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product\/product-slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following in Rank Math:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Source URLs:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>^Product-Categories\/(.+?)\/?$\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Match Type:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Regex\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Destination URL:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/product\/$1\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Redirection Type:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>301 Permanent Move\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ignore Case:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u5f00\u542f\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Status:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Active\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Final result:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/2-ethyl-3-5-dimethylpyrazine\/\n\n\u2192 301\n\n\/product\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Since the old path contains uppercase letters, enabling \"Ignore Case\" ensures compatibility with any case variations that may exist. According to Rank Math's official documentation, URLs are case-sensitive by default, and a \"Ignore Case\" toggle is provided.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Product Category Batch 301 Rule<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The old classification structure was:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/category-slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The new structure is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/category-slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add a second rule:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Source URLs:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>^product-category\/(.+?)\/?$\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Match Type:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Regex\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Destination URL:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/products\/$1\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Redirection Type:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>301 Permanent Move\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Status:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Active\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Final result:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/natural-acid-series\/\n\n\u2192 301\n\n\/products\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For the \"Source URL\" in Rank Math, you can enter either the full URL or just the path following the domain name; the plugin will automatically handle the domain name and leading and trailing slashes. For the \"Destination URL,\" Rank Math officially recommends entering the full address to reduce configuration ambiguity.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What do these regex patterns represent?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>^product-category\/(.+?)\/?$\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>^<\/code>: Matches starting from the beginning of the URL path;<\/li>\n\n\n\n<li><code>product-category\/<\/code>: Matches only this old directory;<\/li>\n\n\n\n<li><code>(.+?)<\/code>: Capture the category slug or subpath that follows;<\/li>\n\n\n\n<li><code>\/?<\/code>: Supports URLs with or without a trailing slash;<\/li>\n\n\n\n<li><code>$<\/code>: Must match up to the end of the path;<\/li>\n\n\n\n<li><code>$1<\/code>: Reuse the captured content in the target URL.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For example, the old URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Among them <code>$1<\/code> The following was captured:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>natural-acid-series\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Target URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/products\/$1\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will ultimately generate:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/products\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Why not use the broadest one? <code>(.*)<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The following rule may also apply:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>^product-category\/(.*)$\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f46 <code>.*<\/code> It can match empty content.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To prevent paths without a category slug from triggering the rule, this article uses:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>(.+?)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At least one character is required.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Regex can match a large number of URLs with a single rule, but a rule that\u2019s too broad may inadvertently affect an entire directory. Rank Math specifically warns that an incorrect regular expression may match too many URLs, so you should test it with a small number of representative links before deploying it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">In what situations should you not rely solely on these two rules?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If any of the following changes occur, you cannot rely solely on a single regular expression:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4ea7\u54c1 slug \u4e5f\u88ab\u4fee\u6539\n\u5206\u7c7b slug \u4e5f\u88ab\u4fee\u6539\n\u5206\u7c7b\u5c42\u7ea7\u53d1\u751f\u53d8\u5316\n\u7236\u5206\u7c7b\u88ab\u5220\u9664\n\u591a\u4e2a\u65e7\u5206\u7c7b\u5408\u5e76\u6210\u4e00\u4e2a\u65b0\u5206\u7c7b\n\u67d0\u4e9b\u4ea7\u54c1\u5df2\u7ecf\u6c38\u4e45\u4e0b\u67b6\n\u4e0d\u540c\u65e7 URL \u9700\u8981\u8df3\u5230\u4e0d\u540c\u76ee\u6807\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Separate, precise redirects should be set up for these types of URLs, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7\uff1a\n\/Product-Categories\/old-product\/\n\n\u65b0\uff1a\n\/product\/new-product\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can configure the following individually:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Source\uff1a\nProduct-Categories\/old-product\/\n\nDestination\uff1a\nhttps:&#047;&#047;example.com\/product\/new-product\/\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Save the permalinks again and clear the cache<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once the setup is complete, we recommend following these steps in the order listed below:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to \u201cSettings \u2192 Permalinks\u201d in WordPress;<\/li>\n\n\n\n<li>If you don't need to make any further changes, just click \u201cSave Changes\u201d;<\/li>\n\n\n\n<li>Clear the cache for FlyingPress, WP Rocket, or any other page caching plugin;<\/li>\n\n\n\n<li>Clear the server or host cache;<\/li>\n\n\n\n<li>Clear the cache from Cloudflare or another CDN;<\/li>\n\n\n\n<li>Retest using your browser's incognito window.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">According to the official WooCommerce documentation, WordPress refreshes the rewrite rules when you save permalinks. If a 404 error appears on a product page after making changes, you can go back to the permalinks page and simply click \"Save\" to force a regeneration of the rewrite rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you only modify the permalinks without refreshing the rewrite rules, the following may occur:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65b0 URL 404\n\u65e7 URL \u91cd\u5b9a\u5411\u5f02\u5e38\n\u540e\u53f0\u663e\u793a\u6b63\u786e\u4f46\u524d\u53f0\u4ecd\u4f7f\u7528\u65e7\u89c4\u5219\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">However, if the cache is not cleared, the following may occur:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u89c4\u5219\u5df2\u7ecf\u4fee\u6539\n\u6d4f\u89c8\u5668\u4ecd\u663e\u793a\u65e7\u7684 301 \u7ed3\u679c\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Use curl to check the actual HTTP status<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Don't just look at which page the browser last opened.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Browsers automatically follow 301 redirects, so you only see the final page, making it difficult to determine:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What is the status code for the first hop?;<\/li>\n\n\n\n<li>Does it pass through multiple addresses in between?;<\/li>\n\n\n\n<li>Is the redirect triggered by Rank Math, Nginx, a CDN, or another plugin?;<\/li>\n\n\n\n<li>Will the target page ultimately return a 200, a 404, or another 301?<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Windows users can open CMD and run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>curl.exe -I https:\/\/example.com\/Product-Categories\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The ideal result should look something like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>HTTP\/1.1 301 Moved Permanently\nX-Redirect-By: Rank Math\nLocation: https:\/\/example.com\/product\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then check the new URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>curl.exe -I https:\/\/example.com\/product\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The ideal outcome is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>HTTP\/1.1 200 OK\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also use:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>curl.exe -IL https:\/\/example.com\/Product-Categories\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Specifically:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>-I\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Indicates that only the response headers are viewed;<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>-L\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Indicates that you will continue to follow the redirect.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The final result should be:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7 URL\n\u2192 301\n\u2192 \u65b0 URL\n\u2192 200\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7 URL\n\u2192 301\n\u2192 \u4e2d\u95f4 URL\n\u2192 301\n\u2192 \u65b0 URL\n\u2192 200\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Google recommends avoiding redirect chains and, whenever possible, having old URLs point directly to their final destination to reduce delays and crawl complexity.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Real-World Issue: Why Do Some Product Categories Redirect to the Home Page?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In this project, most product and product category links are accessible, but a very subtle issue has arisen in some product categories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, visit:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>https:&#047;&#047;example.com\/product-category\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of going to the corresponding category, it went directly to the website's home page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After checking with `curl`, I got results similar to the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>HTTP\/1.1 301 Moved Permanently\nX-Redirect-By: Rank Math\nLocation: https:\/\/example.com\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Another category where similar issues have arisen is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/natural-pyrazine-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The two most important headers here are:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>X-Redirect-By: Rank Math\nLocation: https:\/\/example.com\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">They explain:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>301 is generated by Rank Math;<\/li>\n\n\n\n<li>The target URL is indeed the home page;<\/li>\n\n\n\n<li>The issue isn't a JavaScript redirect in the browser's front end;<\/li>\n\n\n\n<li>It's not just a simple Nginx or CDN redirect either.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Redirects to the Home Page Even After Disabling Regex<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Initial suspicions centered on the newly created product category regex:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>^product-category\/(.*)$\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So we temporarily disabled this redirect.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But run it again:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>curl.exe -I https:\/\/example.com\/product-category\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The result is still:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>HTTP\/1.1 301 Moved Permanently\nX-Redirect-By: Rank Math\nLocation: https:\/\/example.com\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This step essentially rules out:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math Redirections \u5217\u8868\u4e2d\u7684 Regex \u89c4\u5219\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In other words:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">The redirect does indeed come from Rank Math, but it\u2019s not from the two redirect rules we just added.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s an important point to keep in mind when troubleshooting WordPress redirect issues:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>X-Redirect-By: Rank Math\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This does not necessarily mean:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO \u2192 Redirections\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There is a corresponding rule in there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Other global features of Rank Math may also generate redirects.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Check Fallback Behavior<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next, check:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 General Settings\n\u2192 Redirections\n\u2192 Fallback Behaviour\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fallback Behavior can be set to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Default 404\nRedirect to Homepage\nCustom Redirection\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you set this to \"Redirect to Homepage,\" users may be sent to the homepage when certain redirect targets cannot be resolved correctly. According to Rank Math's official documentation, this option determines how the system handles situations where the redirect target does not exist.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this case, the Fallback Behavior is configured correctly and is not the source of the problem.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The real reason is \"Redirect Attachments\"<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After further investigation, we finally pinpointed the issue:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 General Settings\n\u2192 Links\n\u2192 Redirect Attachments\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Close:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Redirect Attachments\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After that, the product categories that had been redirecting to the homepage immediately returned to normal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Revisit:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We are no longer being incorrectly redirected to the homepage, and we can continue to be redirected to the page we specified using the regex we set up:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/products\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Rank Math's \"Redirect Attachments\" feature was originally designed to handle WordPress media attachment pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once enabled:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Attachment pages linked to articles or pages will redirect to the corresponding content;<\/li>\n\n\n\n<li>Standalone attachments not linked to any content can be used to navigate to a specified URL;<\/li>\n\n\n\n<li>The default destination for \"Redirect Orphan Attachments\" is usually the website's home page.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This explains exactly why the following appears in the Header:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>X-Redirect-By: Rank Math\nLocation: https:\/\/example.com\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In other words, some legitimate product category requests were mistakenly caught up in Rank Math\u2019s attachment redirection logic and ultimately routed to the homepage as if they were standalone attachments.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why are only some categories experiencing issues?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">What we can confirm from this hands-on exercise is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u5173\u95ed Redirect Attachments\n\u2192 \u5f02\u5e38\u5206\u7c7b\u7acb\u5373\u6062\u590d\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore, we can conclude that the issue is related to Rank Math's attachment redirect feature.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As for why there are only:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>natural-acid-series\nnatural-pyrazine-series\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Some categories have been affected, and a common explanation is:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>There are identical or similar attachment slugs in the media library;<\/li>\n\n\n\n<li>WordPress encountered a conflict between attachment URLs and taxonomy URLs while parsing the request;<\/li>\n\n\n\n<li>Rank Math incorporates these request errors into its redirect logic.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">However, until we have continued to compare the media library attachment slugs with the database records one by one, we should not conclude that \u201cduplicate attachment slugs\u201d are the sole cause with 100% certainty.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A more accurate conclusion is:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">This case has confirmed that \"Redirect Attachments\" is the feature that triggered the unexpected redirect; further investigation into the media library and database can determine which specific attachment record or URL parsing conflict caused the false positive.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Should \"Redirect Attachments\" Be Disabled Permanently?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For the company's product showcase website in this case, we recommend keeping it closed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The reason is simple:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4ea7\u54c1\u5206\u7c7b\u9875\u9762\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These are pages that truly offer valuable content and SEO benefits, while the attachment pages serve only as supplementary content.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If an attachment redirection feature inadvertently affects product categories, the benefits of disabling it clearly outweigh those of keeping it enabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After closing, you can access:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 Titles &amp; Meta\n\u2192 Attachments\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the index settings on the attachments page; it is generally recommended to set them to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Noindex\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enter at the same time:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 Sitemap Settings\n\u2192 Attachments\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify that the attachments page has not been added to the sitemap.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rank Math also notes that attachment pages on most websites consist of low-value, thin content and are generally not recommended for indexing; after disabling \u201cRedirect Attachments,\u201d the Title, Meta, and Sitemap settings for attachments will reappear.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Another option is to keep \"Redirect Attachments\" enabled, and then:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Search the media library for files with the same name as the exception category;<\/li>\n\n\n\n<li>Check the attachment slug;<\/li>\n\n\n\n<li>Modify the slug of the conflicting attachment;<\/li>\n\n\n\n<li>Clear the cache;<\/li>\n\n\n\n<li>Re-enable \"Redirect Attachments\";<\/li>\n\n\n\n<li>Retest all categories.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">However, for typical corporate websites, disabling attachment redirects and setting attachment pages to \"noindex\" is often a simpler and more reliable approach.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Don't redirect all old URLs to the homepage<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A common mistake made during URL restructuring is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u6240\u6709\u5931\u6548\u4ea7\u54c1\n\u2192 \u9996\u9875\n\n\u6240\u6709\u65e7\u4ea7\u54c1\u5206\u7c7b\n\u2192 \u9996\u9875\n\n\u6240\u6709 404\n\u2192 \u9996\u9875\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is not a proper SEO migration plan.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The correct approach should be:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7\u4ea7\u54c1\n\u2192 \u5bf9\u5e94\u7684\u65b0\u4ea7\u54c1\n\n\u65e7\u5206\u7c7b\n\u2192 \u5bf9\u5e94\u7684\u65b0\u5206\u7c7b\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/natural-acid-series\/\n\n\u2192 301\n\n\/products\/natural-acid-series\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product-category\/natural-acid-series\/\n\n\u2192 301\n\n\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Google explicitly advises against redirecting a large number of old URLs to a single, unrelated page, such as the homepage. This can confuse users and may be interpreted by Google as a \"soft 404.\"<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If an old product has been permanently deleted and there is no similar replacement content, a more reasonable approach might be:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>404 Not Found\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>410 Gone\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It is appropriate to redirect multiple old pages to a single destination only when they have actually been merged into a new, content-related summary page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SEO Follow-Up After a URL Migration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">301 Correct configuration is only a core part of the migration process; it does not mean that the entire upgrade is complete.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following items still need to be checked.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Update All Internal Links<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The website should not continue to link to old URLs and rely on 301 redirects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Items to check:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Navigation Menu;<\/li>\n\n\n\n<li>Footer links;<\/li>\n\n\n\n<li>Manual links in Elementor pages;<\/li>\n\n\n\n<li>Product List;<\/li>\n\n\n\n<li>Related Recommendations;<\/li>\n\n\n\n<li>Category Entries;<\/li>\n\n\n\n<li>Breadcrumbs;<\/li>\n\n\n\n<li>Blog posts;<\/li>\n\n\n\n<li>HTML Sitemap;<\/li>\n\n\n\n<li>Buttons and image links;<\/li>\n\n\n\n<li>Ad landing page;<\/li>\n\n\n\n<li>Custom fields in product data;<\/li>\n\n\n\n<li>URLs in structured data.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For example, internal links should use the following directly:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/2-ethyl-3-5-dimethylpyrazine\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Google recommends updating internal links after a URL migration so that they point directly to the new address, rather than redirecting through the old URL indefinitely.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Check Canonical<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The canonical tag on the new product detail page should point to itself:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>&lt;link rel=&quot;canonical&quot; href=&quot;https:\/\/example.com\/product\/product-slug\/&quot; \/&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">New product category pages should also link to themselves:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>&lt;link rel=&quot;canonical&quot; href=&quot;https:\/\/example.com\/products\/category-slug\/&quot; \/&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It can no longer point to the old one:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/\n\/product-category\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Google will permanently redirect and <code>rel=\"canonical\"<\/code> All of these are considered strong canonicalization signals, while the sitemap is a relatively weak supplementary signal. Ensuring that 301 redirects, canonical tags, internal links, and the sitemap all point to the new URL can reduce ambiguity for search engines when determining the canonical URL.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Update XML Sitemap<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After the migration is complete, the sitemap generated by Rank Math should only include the new URLs:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/product\/\n\/products\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Old URLs should no longer appear in the sitemap as indexable addresses.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Google recommends including only the canonical URLs you want to appear in search results in your sitemap.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After the update, you can resubmit your sitemap in Google Search Console.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Search Console subsequently marks the old URL as:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Page with redirect\n\u7f51\u9875\u4f1a\u81ea\u52a8\u91cd\u5b9a\u5411\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is usually normal, since the old URL is supposed to return a 301 response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Check Multilingual hreflang<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If the website has multiple language versions, you\u2019ll also need to update them simultaneously:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>hreflang\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example, the `hreflang` attributes between the old English pages and pages in other languages should no longer reference the old URLs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In its URL migration documentation, Google explicitly recommends that, during migration, in addition to updating the canonical tag, you should also update the multilingual pages' <code>rel-alternate-hreflang<\/code> Address.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Use Search Console to check representative URLs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It is recommended to conduct random inspections of the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An old product URL;<\/li>\n\n\n\n<li>A new product URL;<\/li>\n\n\n\n<li>An old product category URL;<\/li>\n\n\n\n<li>A URL for a new product category;<\/li>\n\n\n\n<li>A product category that used to incorrectly redirect to the homepage;<\/li>\n\n\n\n<li>A subcategory with a parent directory;<\/li>\n\n\n\n<li>A product that is important in terms of backlinks or search rankings.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The inspection objectives include:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7 URL \u8fd4\u56de 301\nLocation \u6307\u5411\u6b63\u786e\u65b0 URL\n\u65b0 URL \u8fd4\u56de 200\n\u65b0 URL \u5141\u8bb8\u7d22\u5f15\nCanonical \u6307\u5411\u65b0 URL \u81ea\u8eab\nGoogle \u6293\u53d6\u5230\u7684\u662f\u6700\u7ec8\u9875\u9762\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Since this is merely a change in the path within the same domain and does not constitute a domain migration, there is no need to use Search Console\u2019s Change of Address tool. That tool is primarily used for migrating from one domain to another; the key focus for path adjustments within the same domain is 301 redirects, URL Inspection, sitemaps, and ongoing monitoring.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Keep 301 in place long enough<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Do not remove the 301 redirect from the old URL just a few weeks after the new URL has been indexed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Google recommends keeping redirects in place for as long as possible\u2014typically at least one year\u2014to allow for the re-crawling of old URLs, the replacement of index entries, and the migration of link signals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From the perspective of user experience, backlinks, legacy documents, and bookmark compatibility, these pages can be retained long-term or even permanently if there are no significant maintenance costs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Monitoring Index and Traffic Changes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After the migration, the following short-term issues may occur:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fluctuations in the number of entries;<\/li>\n\n\n\n<li>Both the old and new URLs appear in the report;<\/li>\n\n\n\n<li>The old URL displays a redirect;<\/li>\n\n\n\n<li>The new URL has not yet been fully replaced;<\/li>\n\n\n\n<li>There have been slight fluctuations in the rankings for some keywords.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Google notes that it may take several weeks for small and medium-sized websites to complete the re-crawling and index migration of most of their URLs, and it is not uncommon for search visibility to fluctuate temporarily during the migration process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following points require close attention:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Are new URLs being continuously discovered and indexed;<\/li>\n\n\n\n<li>Does the old URL consistently return a 301 response?;<\/li>\n\n\n\n<li>Are there a large number of 404 errors?;<\/li>\n\n\n\n<li>Are there any old URLs that are redirected to the homepage?;<\/li>\n\n\n\n<li>Is there a redirect loop?;<\/li>\n\n\n\n<li>Is there a new URL with a canonical tag pointing back to the old URL?<\/li>\n\n\n\n<li>Does the sitemap still include the old paths?;<\/li>\n\n\n\n<li>Is traffic for products and categories gradually shifting to the new URL?<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Final Validation Criteria<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once this product URL restructuring is complete, the ideal outcome should be:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7\u4ea7\u54c1 URL\n\/Product-Categories\/product-slug\/\n\n\u2192 301\n\n\u65b0\u4ea7\u54c1 URL\n\/product\/product-slug\/\n\n\u2192 200\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The product categories should be:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7\u4ea7\u54c1\u5206\u7c7b\n\/product-category\/category-slug\/\n\n\u2192 301\n\n\u65b0\u4ea7\u54c1\u5206\u7c7b\n\/products\/category-slug\/\n\n\u2192 200\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Must satisfy all of the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The old URL is redirected only once;<\/li>\n\n\n\n<li>Old products correspond to new products;<\/li>\n\n\n\n<li>The old categories correspond to the new categories;<\/li>\n\n\n\n<li>Do not redirect to the home page in bulk;<\/li>\n\n\n\n<li>The new URL returns a 200 status code;<\/li>\n\n\n\n<li>The new canonical URL points to itself;<\/li>\n\n\n\n<li>The sitemap contains only new URLs;<\/li>\n\n\n\n<li>Use the new URL directly for internal links;<\/li>\n\n\n\n<li>The hreflang tags for the multilingual website have been updated;<\/li>\n\n\n\n<li>Features such as \"Rank Math Remove Base\" did not continue to rewrite the URLs;<\/li>\n\n\n\n<li>Redirect Attachments no longer incorrectly affects product categories;<\/li>\n\n\n\n<li>There are no residual cached redirects from FlyingPress, the server, or the CDN.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">My WooCommerce product URLs have already been indexed. Can I still edit them?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, it is necessary to assess whether changes are needed and to set up permanent 301 redirects from the old URLs to their corresponding new URLs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the old URL itself has no obvious issues and has already achieved stable rankings and a large number of backlinks, it is not recommended to modify it frequently just to shorten the URL.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">There are a lot of products. Do I need to add redirects one by one?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Not necessarily.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you're just changing the prefix across the board, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\/Product-Categories\/slug\/\n\u2192 \/product\/slug\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">As long as the slug remains unchanged, you can use Rank Math Regex to process them in bulk.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the slug also changes, you'll need to set up one-to-one redirects for these specific URLs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>product-category<\/code> Change to <code>products<\/code> Will it improve my ranking?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We cannot guarantee that.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Its main benefit is that it makes URLs more concise, natural, and consistent with the website's information architecture.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rankings continue to depend primarily on page content, alignment with search intent, on-site structure, backlinks, technical crawlability, and overall website quality.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should You Use a 301 or a 302 for Permanent URL Changes?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>301 Permanent Move\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">302 indicates a temporary redirect and is used in situations where the old URL will be restored in the future.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This URL structure change is a long-term adjustment, so we are using a 301 redirect.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why does the header show \"X-Redirect-By: Rank Math,\" but there are no rules in the redirect list?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is because Rank Math's redirects don't just come from:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>Rank Math SEO\n\u2192 Redirections\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It may also come from:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Redirect Attachments;<\/li>\n\n\n\n<li>Redirect Orphan Attachments;<\/li>\n\n\n\n<li>Fallback Behavior;<\/li>\n\n\n\n<li>WooCommerce Remove Base;<\/li>\n\n\n\n<li>Remove Category Base;<\/li>\n\n\n\n<li>Auto Post Redirect;<\/li>\n\n\n\n<li>Other Rank Math URL handling logic.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore, when encountering a problem, you need to check the header, global settings, and specific redirect rules all at the same time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Will disabling \"Redirect Attachments\" affect SEO?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It may not necessarily have a negative impact.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For most corporate websites and general-purpose content sites, attachment pages have little value in and of themselves.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After disabling \"Redirect Attachments,\" you can set the attachment page to \"Noindex\" and exclude it from the XML sitemap. This prevents thin content on the attachment page from being indexed and also prevents it from continuing to negatively impact normal product categories.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why do only some product categories link back to the home page?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This case has been confirmed to be an exception triggered by the \"Redirect Attachments\" feature.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If only some categories are affected, it usually means that these category requests are conflicting with certain attachment URLs, attachment slugs, or WordPress request parsing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can disable \"Redirect Attachments,\" or you can continue to check the media library for attachments with the same name as the exception category.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What should I do if a new page shows a 404 error after changing the permalink?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, go to:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u8bbe\u7f6e\n\u2192 \u56fa\u5b9a\u94fe\u63a5\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Without making any changes, simply click \u201cSave Changes.\u201d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then clear them in the following order:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Page Caching;<\/li>\n\n\n\n<li>Server cache;<\/li>\n\n\n\n<li>CDN caching;<\/li>\n\n\n\n<li>Browser cache.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you still get a 404 error, check whether the product base and product category base conflict, and whether Rank Math has enabled additional URL rewrite features such as \"Remove Base\" and \"Remove Category Base.\"<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why can't we set all old products to redirect to the homepage?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is because the homepage typically cannot meet users' needs when they are looking for specific products or categories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A large number of irrelevant URLs redirecting to the homepage may be viewed by Google as \"soft 404s\" and could also result in the loss of the original thematic relevance of the old pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Old products should redirect to their corresponding new products, and old categories should redirect to their corresponding new categories.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How long should a 301 redirect remain in place?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Google recommends keeping it for at least one year.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the old URL is still referenced by external links, bookmarks, archived documents, or advertising materials, it is generally safer to keep it active for the long term.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to Determine Whether the Entire Migration Was Successful<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The most crucial criterion is:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u65e7 URL\n\u2192 \u4e00\u6b21 301\n\u2192 \u5bf9\u5e94\u65b0 URL\n\u2192 200\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At the same time, ensure that the canonical URL, internal links, and sitemap for the new URL all use the new address consistently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summarize<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Rewriting WooCommerce product URLs isn't just a matter of modifying two permalink fields; it's a complete URL migration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The correct procedure should be:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u89c4\u5212\u65b0 URL\n\u2192 \u6574\u7406\u65e7\u65b0 URL \u6620\u5c04\n\u2192 \u4fee\u6539 WooCommerce \u56fa\u5b9a\u94fe\u63a5\n\u2192 \u68c0\u67e5 Rank Math URL \u529f\u80fd\n\u2192 \u8bbe\u7f6e Regex 301\n\u2192 \u5237\u65b0 Rewrite Rules\n\u2192 \u6e05\u9664\u5168\u90e8\u7f13\u5b58\n\u2192 \u4f7f\u7528 curl \u9a8c\u8bc1\n\u2192 \u6392\u67e5\u5f02\u5e38\u8df3\u8f6c\n\u2192 \u66f4\u65b0\u5185\u94fe\u3001Canonical\u3001hreflang \u548c Sitemap\n\u2192 \u5728 Search Console \u4e2d\u6301\u7eed\u76d1\u63a7\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When a website has a large number of products but you only need to uniformly modify the prefixes of products or product categories, Rank Math Regex can handle the bulk migration with just a few rules, eliminating the need to add them one by one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, what truly determines the quality of the migration is not whether a 301 redirect has been set up, but whether each old URL is redirected correctly:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>\u4e00\u6b21 301\n\u2192 \u5230\u8fbe\u6700\u76f8\u5173\u7684\u65b0 URL\n\u2192 \u6700\u7ec8\u8fd4\u56de 200\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The most valuable finding in this case study is that the issue where some product category pages were redirecting to the homepage was not caused by the newly created Regex rule, but rather by Rank Math\u2019s \u201cRedirect Attachments\u201d feature, which inadvertently affected legitimate category requests.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After pausing the rule, checking the HTTP headers, and disabling the fallback behavior\u2014and finally turning off \u201cRedirect Attachments\u201d\u2014the issue was resolved. This also illustrates that when troubleshooting WordPress redirect issues, you shouldn\u2019t just focus on the \u201cRedirections\u201d list in the admin panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Combination:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-auto-translation=\"\"><code>HTTP \u72b6\u6001\u7801\nLocation\nX-Redirect-By\nRank Math \u5168\u5c40\u8bbe\u7f6e\nWooCommerce \u56fa\u5b9a\u94fe\u63a5\nWordPress Rewrite Rules\n\u9875\u9762\u4e0e CDN \u7f13\u5b58\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Only by conducting a layer-by-layer investigation can you truly identify the source of abnormal redirects and safely complete the URL restructuring for websites already indexed.<\/p>","protected":false},"excerpt":{"rendered":"<p>Can URLs for WooCommerce products and product categories that have already been indexed by Google be modified? Based on a real-world project, this article provides a comprehensive demonstration of permalink restructuring, bulk 301 redirects using Rank Math Regex, verification via cURL, and the troubleshooting process for an issue where the \u201cRedirect Attachments\u201d plugin caused some product categories to redirect to the homepage.<\/p>","protected":false},"author":1,"featured_media":5797,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[99],"tags":[],"class_list":["post-5796","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-optimization"],"acpt":{"meta":[]},"_links":{"self":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/posts\/5796","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/comments?post=5796"}],"version-history":[{"count":2,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/posts\/5796\/revisions"}],"predecessor-version":[{"id":5799,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/posts\/5796\/revisions\/5799"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/media\/5797"}],"wp:attachment":[{"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/media?parent=5796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/categories?post=5796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.6ebook.com\/en\/wp-json\/wp\/v2\/tags?post=5796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}