PrestaShop 新分类链接指向错误类别问题排查求助
Hey there, let's dig into why your new category (ID 12) is redirecting to the old ID 5 category in PrestaShop 1.7.5.2. Since you haven’t modified any code, these are the most probable causes and fixes to check:
Cached URL Rewrite Rules
PrestaShop relies heavily on caching for URL generation, and stale cache is one of the most common culprits here.- Fix steps: Head to your backoffice, go to
Advanced Parameters > Performance, then clear all caches (Smarty cache, cache directory, compiled templates). Next, navigate toSEO & URLs, ensureFriendly URLis enabled, and clickGenerate .htaccess fileto refresh rewrite rules. Don’t forget to clear any server-side caching (like Redis, APC, or CDN cache) if you’re using it.
- Fix steps: Head to your backoffice, go to
Duplicate or Incorrect Slug in SEO Settings
Even though your URL structure usesID-CATEGORY_NAME, a misconfigured slug could cause a conflict.- Fix steps: Go to
Catalog > Categories, edit your ID 12 category, switch to theSEOtab. Verify theFriendly URLfield is set to12-categorynew. Then check the ID 5 category’s SEO tab to confirm its slug is5-categoryold. If the new category’s slug was accidentally set to match the old one, update it and clear cache afterward.
- Fix steps: Go to
Corrupted URL Rewrite Database Entries
Theps_url_rewritetable in your database might have incorrect mappings linking the new category to the old one.- Fix steps: Access your database via phpMyAdmin, locate the
ps_url_rewritetable. Search for entries whereid_category = 12—check thatid_objectmatches 12 andlink_rewriteis12-categorynew. Also, look for any entries wherelink_rewrite = 12-categorynewbutid_category = 5; delete or correct those entries, then clear your store’s cache.
- Fix steps: Access your database via phpMyAdmin, locate the
Accidental Parent Category Misconfiguration
While less likely with your ID-based URL structure, it’s worth checking if the new category was incorrectly set as a child of the old one, causing URL inheritance.- Fix steps: Edit the ID 12 category, go to the
Generaltab, and verify theParent categoryis set correctly (e.g., root category, not ID 5). Adjust if needed and save changes.
- Fix steps: Edit the ID 12 category, go to the
Broken .htaccess Rules
Sometimes the auto-generated.htaccessfile can have outdated or incorrect rewrite rules, even if you didn’t edit it manually.- Fix steps: Go to
SEO & URLsin your backoffice and clickGenerate .htaccess fileto overwrite the existing one. If that doesn’t work, you can compare your current.htaccesswith the official PrestaShop 1.7.5.2 template (from a fresh installation of the same version) to spot discrepancies.
- Fix steps: Go to
If none of these fix the issue, check if you have any SEO or URL optimization modules installed—third-party plugins can sometimes interfere with default URL handling.
内容的提问来源于stack exchange,提问作者Jorhanc

