Hello,
I apologize for the inconvenience you are facing with the product categories intermittently displaying an Error 404 after stripping the category base.
Based on the issue you described, it seems like there might be a caching or conflict issue causing the problem. Here are some steps you can take to address this:
-
Flush the Cache: Ensure that any caching plugins you have are not caching the permalinks or interfering with the category URLs. You can try flushing the cache after making changes to see if that resolves the issue.
-
Check for Plugin Conflicts: Sometimes conflicts with other plugins can cause such issues. Temporarily deactivate other plugins one by one to see if any of them are conflicting with Rank Math and causing the problem.
-
Review Server Configuration: Ensure that your server configuration is compatible with the permalink structure changes you have made. Check if there are any specific server rules or settings that might be affecting the category URLs.
If the issue persists after trying these steps, please assign this ticket to a human agent using the available buttons so that they can investigate further and provide a more tailored solution.
Thank you for bringing this to our attention, and we appreciate your patience as we work to resolve this issue for you.
Warm regards.
Sources:
WordPress Permalink Structure & Changing Individual URLs » Rank Math
Why the Sitemap_Index.xml is Throwing a 404 Error » Rank Math
How to Optimize a Category Page » Rank Math
How to Fix 404 Errors with Rank Math SEO Plugin
How to Find Out Where 404 Errors Are Coming From » Rank Math
Thanks for the recommendations.
1. Cache has been flushed multiple times throughout issue occurring
2. Regarding plugin conflicts, i cannot see anything directing to that being an issue.
3. Server config should be appropriate.
Thanks
Kind Regards
Hello,
Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.
From the description you’ve shared, it looks like the permalinks are not sticking for more than a couple of hours and that’s why you’re facing this issue frequently. We’ve seen some similar issues in the past and the most common fix for this kind of issue is to refresh the permalinks programmatically.
To do that, you could add the following snippet to flush the permalinks every hour and prevent the error from appearing:
add_action('my_hourly_event', 'do_this_hourly');
function my_activation() {
if ( !wp_next_scheduled( 'my_hourly_event' ) ) {
wp_schedule_event(time(), 'hourly', 'my_hourly_event');
}
}
add_action('wp', 'my_activation');
function do_this_hourly() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how it goes. Looking forward to helping you.
Thank you.
Thanks for that, Surprisingly this has not occurred for a day it might be that enabling Auto Post Redirection has Fixed it.
Should this occur again i will implement the code you have suggested.
Thank you
Hello,
We are glad that everything is now working properly.
If you face the issue again, you can apply the code on your site.
Meanwhile, please don’t hesitate to let us know if you have any other questions.
Looking forward to helping you.
Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.