Close Menu
WP USTAADWP USTAAD
  • About Us
  • Contact Us
  • WordPress Website
  • WordPress Themes
  • WordPress Security
  • WordPress Plugins
What's Hot

5 Best WordPress Migration Plugins in 2026 (Compared)

September 18, 2026

How to Fix 404 Errors & Broken Permalinks After WordPress Migration (2026)

September 17, 2026

How to Clone a WordPress Site to a Staging Environment Safely (2026 Guide)

September 15, 2026
Facebook Instagram YouTube
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
Facebook Instagram YouTube LinkedIn
WP USTAADWP USTAAD
  • About Us
  • Contact Us
  • WordPress Website
  • WordPress Themes
  • WordPress Security
  • WordPress Plugins
WP USTAADWP USTAAD
Home » Blog » How to Fix 404 Errors & Broken Permalinks After WordPress Migration (2026)
Wordpress Migration

How to Fix 404 Errors & Broken Permalinks After WordPress Migration (2026)

Shariq MoizBy Shariq MoizSeptember 17, 2026Updated:September 24, 2026No Comments3 Mins Read
Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
WP Ustaad WordPress developer guide: WordPress-Migration-Checklist
Share
Facebook Twitter LinkedIn Pinterest Email
📑 Table of ContentsHide / Show
  1. Why 404 Errors Occur Post-Migration
  2. Fix 1: The 10-Second Permalink Flush
  3. Fix 2: Manually Recreating .htaccess
  4. Fix 3: Enabling mod_rewrite on VPS / Apache
  5. Nginx Rewrite Directives & Automated 404 Monitoring
  6. Frequently Asked Questions

Why 404 Errors Occur Post-Migration

It is common after migrating WordPress to a new server to find that while the homepage loads properly, every internal blog post, page, and category throws a dreaded 404 Not Found error. This happens because web server rewrite rules in .htaccess were not generated or the web server configuration is ignoring directory rewrites.

Fix 1: The 10-Second Permalink Flush

The simplest and most effective fix requires zero code:

  1. Log in to your WordPress admin dashboard on the new server.
  2. Navigate to Settings → Permalinks.
  3. Do not change any settings; simply scroll to the bottom and click Save Changes.
  4. Click Save Changes a second time. This forces WordPress to regenerate its internal rewrite array and write fresh rewrite directives to your web server.

Fix 2: Manually Recreating .htaccess

If WordPress lacks write permissions to your root directory, create or edit the .htaccess file manually and paste the standard WordPress rewrite block:

# 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

Fix 3: Enabling mod_rewrite on VPS / Apache

If you manage your own Ubuntu or Debian VPS server, verify that the Apache rewrite module is enabled:

sudo a2enmod rewrite
sudo systemctl restart apache2

⚡ Related WordPress Migration & Hosting Guides

  • How to Clone a WordPress Site to a Staging Environment – Test updates, themes, and plugins safely without risking live downtime.
  • Step-by-Step WordPress Migration with Duplicator Plugin – Complete free & pro guide to package and deploy full WordPress databases.
  • How to Change WordPress Domain Name & Fix Database URLs – Use search-replace tools to update URLs without serialization breaks.
  • Top 7 Image Optimization Plugins for WordPress – Next-gen WebP & AVIF compression to pass Google PageSpeed audits.

Nginx Rewrite Directives & Automated 404 Monitoring

When migrating a WordPress site from an Apache host to a high-speed Nginx server (such as LEMP or RunCloud), the classic .htaccess file is completely ignored. As a consequence, while the homepage functions normally, clicking any blog post or category link produces an instant 404 Not Found error.

To resolve this on Nginx, ensure your site’s server configuration file contains the universal WordPress rewrite block inside the primary location directive:

# Essential Nginx WordPress Permalink Rewrite
location / {
    try_files $uri $uri/ /index.php?$args;
}

After saving, test your configuration with sudo nginx -t and reload the service with sudo systemctl reload nginx. Additionally, deploy a lightweight 404 monitoring plugin like Redirection for the first 14 days post-migration to track and catch any orphaned backlink URLs.

Frequently Asked Questions

Why do blog posts show 404 errors while the homepage loads fine after migration?
The homepage is served directly by the web server index file, but custom permalinks require active rewrite rules (mod_rewrite in Apache or try_files in Nginx) to route dynamic requests to index.php.

How do I quickly flush WordPress rewrite rules without FTP or SSH access?
Simply log in to your WordPress dashboard, navigate to Settings → Permalinks, and click the blue “Save Changes” button at the bottom of the page without changing any settings.

Can aggressive caching plugins cause persistent 404 errors after domain transfer?
Yes. Outdated cached rewrite maps or old domain transients stored in Redis/Memcached will serve 404s until the object cache and page cache are completely purged.


Troubleshooting WordPress Migration
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous ArticleHow to Clone a WordPress Site to a Staging Environment Safely (2026 Guide)
Next Article 5 Best WordPress Migration Plugins in 2026 (Compared)
Shariq Moiz
  • Website

Shariq Moiz is a Full-Stack WordPress Engineer, Performance Architect, and Founder of WP Ustaad based in North Nazimabad, Karachi, Pakistan. Specializing in Core Web Vitals, speed optimization, theme development, and high-scale WooCommerce systems.

Related Posts

Wordpress Migration

5 Best WordPress Migration Plugins in 2026 (Compared)

September 18, 2026
Wordpress Migration

How to Clone a WordPress Site to a Staging Environment Safely (2026 Guide)

September 15, 2026
Wordpress Migration

Step-by-Step WordPress Migration with Duplicator Plugin (Free & Pro 2026)

September 14, 2026
Add A Comment
Leave A Reply Cancel Reply

Top Posts

Best Premium WordPress Themes 2026 & Top Free Themes for Every Website

July 3, 2026

5 Best WordPress Migration Plugins in 2026 (Compared)

September 18, 2026

How to Create a WordPress Blog in 2026

July 5, 2026
⚡ WP USTAAD
Learn  |  Build  |  Grow

WP Ustaad is a premier educational hub offering practical, staging-tested WordPress tutorials, theme reviews, speed optimization tips, and security guides based in North Nazimabad, Karachi.

📖 Expert Guides 🛡️ Practical Tips ⚡ For All Levels

CONNECT WITH US

QUICK LINKS

  • › Home
  • › About Us
  • › Privacy Policy
  • › Disclaimer
  • › Contact Us
  • › Terms & Conditions
  • › Free Resources
  • › All Tutorials

🔥 MOST POPULAR

Top 20 Must-Have WordPress Plugins July 26, 2025
How to Use AI in WordPress (Fast Guide) July 27, 2025
WordPress Security
WordPress Security in 2025: Protect Your Site July 26, 2025
WordPress Plugins
Best WordPress Plugins for Beginners July 26, 2025

⭐ OUR PICKS

Avada Theme
Best WordPress Theme: Why Developers Choose Avada July 27, 2025
Create WordPress Website
How to Create a WordPress Website (Beginner's Guide) July 27, 2025
Migrate WordPress
How to Migrate Your WordPress Website (2025 Guide) July 27, 2025
© 2026 WP USTAAD

Type above and press Enter to search. Press Esc to cancel.