• On a multisite with a single install of wordpress, posts on the root domain, i.e. example.com/post-name/ will periodically redirect or 302 to example.com?

    This issue came out of nowhere and without making any major changes…it doesn’t occur on second or third level domains, just posts on the root.

    .htaccess and wp-config look fine. Changing the permalink of the post doesn’t help.

    The only solution is saving the same exact permalink settings. I.e. going to example.com/wp-admin/options-permalink.php and clicking save without changing anything.

    Our developer is adept in .php, logged redirect files and still, him and I are both stumped as to why this might be happening.

    I’m happy to provide more details but not quite sure what else to check/where else to look/best way to diagnose…any help or ideas is/are greatly appreciated.

    • This topic was modified 2 months, 2 weeks ago by nebula10.
    • This topic was modified 2 months, 2 weeks ago by nebula10.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    So a single post request sometimes gets redirected to the home page? And re-saving permalinks settings resolves this? This indicates an issue with WP rewrite rules. If the problem eventually returns, requiring another permalinks settings save, it likely means your theme or one of your plugins is messing with rewrite rules.

    You’ll want to narrow down which module is responsible. To do so efficiently, you’ll want to be able to consistently cause the problem to occur. For example, requesting a specific post always gets redirected? Switch to a default theme and deactivate all plugins. Revisit the permalinks settings. You likely don’t even need to save, just loading the screen causes rewrite rules to be regenerated. The redirect problem should no longer occur.

    Restore your normal theme and plugins, one at a time, each time going to permalink settings and then testing for a redirect. When the problem recurs, the issue is with the last activated module. Take up the issue in that module’s dedicated support channel.

    Thread Starter nebula10

    (@nebula10)

    @bcworkz thanks for taking a look.

    Unfortunately the issue occurs on all root posts and yeah, oddly enough, saving permalink settings is the solution.

    Hmmm, we have a custom theme and don’t auto-upgrade plugins or install new ones often.

    Although, 3 weeks prior to noticing the first instance of the issue our hosting company KH upgraded all sites on our server to php 8.1 (unsure of prior version). It’s happened 2x since then so it’s not a 1-off-issue.

    Do you think this might have something to do with it?

    I can’t seem to recreate it regardless of what I try. And if it does return, I can test going to the permalink settings page without saving.

    But uninstalling all plugins and using a default theme isn’t feasible on the live site.

    Moderator bcworkz

    (@bcworkz)

    You can use the Health check & Troubleshooting plugin to help you debug the site without affecting other visitors. Only your view of the site is affected in troubleshooting mode.

    If visiting permalinks settings without saving resolves the issue, then something is certainly messing with the rewrite rules. If not, something is messing with the permalink setting itself and not the rewrite rules.

    The problem is, if you cannot induce the issue somehow, it’s going to take a long time to resolve this through trial and error of deactivating different modules. The troubleshooting mode might not even help in such a situation since it works by making a clone of your site to test with. It’s conceivable the problem could be induced on the production version without affecting the clone.

    Thread Starter nebula10

    (@nebula10)

    @bcworkz thanks for the suggestions. I suppose I can take a backup when this happens again and diagnose on local as well.

    All of that makes sense.

    I had considered auto-magically saving the permalink settings a few times per day but that’s definitely a bandaid and would impede on diagnosing.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.