2

I'm running the latest (and constantly updated) version of WordPress on Nginx.

Every now and then I wake up to a site full of 404 errors. The fix is to go into the permalinks and just save the settings on that page. This typically fixes the issue for a day or so.

This was happening to another site of mine on the same server. It suddenly stopped being an issue. My point here is that not only do I not know what's causing it, but I can't even tell what's fixing it.

1
  • 1
    Visiting the Permalinks page flushes your permalinks rules and forces WordPress to reload them. That's probably why you see the issue go away after visiting that page. As for what's causing the issue, I couldn't say based on the limited information. I'd start by removing plugins from the equation and possibly even swapping to the twentyfifteen theme for a bit to see if the issue persists. That may help you narrow the issue down.
    – dswebsme
    Commented Oct 5, 2015 at 13:40

4 Answers 4

1

Same problem for the last few weeks, using nginx not apache, Switching rule saving, then switching rule back and saving fixes it for a day...

0

While I'm not sure what could be causing your 404 problem, here are some suggestions:

  • Deactivate plugins and see if that fixes the problem. If so, reactivate one at a time until you get the problem again
  • Change to a different theme and see if that fixes it
  • Make sure the .htaccess file isn't somehow getting changed - this file configures how your web server handles requests by routing them to the proper place

Other than that, I couldn't say more of what could be causing this with so little information.

The Fix

You did say that saving the Permalinks Settings fixed the issue but can't tell why. When you visit Permalinks Settings (you shouldn't even have to save), the function flush_rewrite_rules runs. The description from the Codex is pretty straightforward: Remove rewrite rules and then recreate rewrite rules.

2
  • Unfortunately, our production environment isn't really a place where I can just switch themes and turn off plugins. Oddly enough, this never happens on our dev server which is identical in setup.
    – Tspesh
    Commented Oct 5, 2015 at 13:56
  • I would go over it with a fine-tooth comb then: make sure they are really identical. Code base, nginx, .htaccess, server configuration, etc. See if there are any discrepancies, particularly in server config.
    – phatskat
    Commented Oct 5, 2015 at 14:03
0

I have an Apache server, and it happens to our site as well. We have another site on the same server and this never loses the permalinks. It's getting so bad that I need to login and re-save the permalinks each day. I have mirrored the plugins and settings from the site without the problems and have deleted and made a fresh .htaccess but still no help.

-2

Go to the permalinks settings of your Wordpress site and save as it is. If it is not working check your .htaccess file and add

# BEGIN WordPress
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>
# END WordPress
1
  • 1
    Please just note if you want to promote or recommend your own product/blog, there are some guidelines in place for doing so. Following them will help you avoid giving the impression that you're spamming.
    – 4b0
    Commented Mar 26, 2019 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.