WordPress: 404 Not Found on every page except the homepage (permalinks / .htaccess / Nginx rules)
Pretty permalinks aren’t being routed to index.php — .htaccess is missing/ignored (Apache) or Nginx lacks try_files.
Seen on:
WordPress
Meaning
After migrations or server changes, the rewrite rules disappear. On Apache, AllowOverride None or mod_rewrite disabled ignores .htaccess; on Nginx, .htaccess never works and needs try_files.
Common causes
- .htaccess missing or not writable
- Apache AllowOverride None / mod_rewrite disabled
- Nginx without try_files $uri $uri/ /index.php?$args
- Site moved to a subfolder without updating RewriteBase
⚡ Quick fix
- Settings → Permalinks → Save (regenerates rules)
- Enable mod_rewrite and AllowOverride All
- Add try_files to the Nginx location block
Detailed fix by platform
Apache
- apache
# .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
Nginx
- nginx
location / { try_files $uri $uri/ /index.php?$args; }
How to diagnose
- Server — Apache or Nginx?
- Rules — .htaccess / try_files present?
- Modules — mod_rewrite enabled?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in WordPress
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026