How To Fix WordPress Permalinks Not Working After Migration?

Fix WordPress Permalinks Not Working After Migration

WordPress permalinks not working after migration? You’re not alone. Whether you’ve just moved your site to a new domain or switched hosts, broken permalinks are one of the most frustrating post-migration issues. This guide walks you through how to fix it fast and restore clean, SEO-friendly URLs.

Why Permalinks Break After WordPress Migration

When you migrate a WordPress site, settings related to permalink structure often get corrupted or reset. This causes URLs to break, resulting in 404 errors, broken internal links, and tanked SEO performance. The good news? It’s fixable — and usually without any plugins.

1. Reset Permalinks via WordPress Settings

Go to Settings → Permalinks and simply hit “Save Changes” without editing anything. This flushes and rebuilds the rewrite rules. For most cases, this instantly fixes the issue.

2. Manually Flush Rewrite Rules (Code Method)

If your permalinks still don’t work, add this to your theme’s functions.php temporarily:

flush_rewrite_rules();

This forces WordPress to rewrite permalink rules. Remember to remove this line after the first page load.

3. Check .htaccess File (Apache Servers)

For sites on Apache, a broken or missing .htaccess file can block permalinks. Ensure this default WordPress block exists:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

4. Enable mod_rewrite Module

Still not fixed? Your Apache server might not have mod_rewrite enabled. Contact your hosting support or enable it via terminal if self-hosted:

sudo a2enmod rewrite
sudo service apache2 restart

5. For NGINX Users: Check Rewrite Rules

If you’re on NGINX, permalinks won’t work with .htaccess. You’ll need to configure pretty permalinks manually inside your server block:

location / {
 try_files $uri $uri/ /index.php?$args;
}

Update and reload NGINX using sudo service nginx reload.

6. Database Migration Plugin Didn’t Rewrite URLs

Tools like Duplicator or All-in-One WP Migration sometimes skip URL rewrites. Use Better Search Replace to search and replace your old domain with the new one in the database.

7. Fix 404 Errors After Changing Permalink Structure

Changing permalink structure post-migration (e.g., from /?p=123 to /%postname%/) can break URLs. Always save permalinks after edits and redirect old URLs using Redirection.

8. Use .htaccess Redirects for Old URLs

If old URLs are indexed or linked elsewhere, redirect them using 301s in your .htaccess:

Redirect 301 /old-post/ https://yoursite.com/new-post/

9. Clear All Caches

Always clear browser cache, WordPress caching plugins (like WP Rocket or W3 Total Cache), and CDN (like Cloudflare) after fixing permalink issues to reflect changes.

10. Restore SEO and Broken Links

Run a scan using Broken Link Checker and update internal links manually or via plugin. This helps recover from SEO loss due to the permalink structure breaking.

Conclusion

If your WordPress permalinks are not working after migration, don’t panic. Reset settings, check your server, flush rules, and rebuild your .htaccess or NGINX configs. You’ll have clean, crawlable, SEO-friendly URLs again in no time.

Still stuck? Contact me and I’ll help you sort it out personally.

If you’re also stuck on the login screen after migration, don’t miss our full guide on fixing the WordPress login redirect loop. And once your site’s stable again, check out our curated list of best WordPress plugins for business websites to help improve speed, security, SEO, and overall performance.

Frequently Asked Questions

Permalinks can break after migration due to missing .htaccess rules, unflushed rewrite rules, or server-level issues like mod_rewrite being disabled.

You can fix this by saving permalinks under Settings → Permalinks, flushing rewrite rules in functions.php, and checking .htaccess or NGINX config.

Yes, if your new server doesn’t carry over .htaccess or uses different URL rewrite rules (like NGINX), your permalinks can break after the switch.

If rewrite rules aren’t flushed or the server config isn’t updated, old URLs may return 404 errors. Always resave permalinks after changes.

Create a .htaccess file in your root directory and paste the default WordPress rules. Make sure mod_rewrite is enabled.

Yes. Use a tool like Better Search Replace to update all instances of your old domain in the database — especially for hardcoded URLs.

Absolutely. Some permalink or redirection plugins may not be installed post-migration. Reinstalling or updating plugins can help fix routing issues.

Add flush_rewrite_rules(); to your functions.php file temporarily, then reload the site. Don’t forget to remove the code afterward.

Edit your NGINX config file and add the correct try_files directive to route traffic to index.php. Then restart NGINX.

Yes. If permalinks break, search engines may return 404s, hurting rankings. Fixing them quickly and setting up redirects can prevent SEO loss.

Leave a Reply

Your email address will not be published. Required fields are marked *

    Branding Design Development Front-End Website-Redesigning Shopify-Development WordPress-Development
    Branding Design Development Front-End Website-Redesigning Shopify-Development WordPress-Development
    We love crafting unforgettable
    digital experiences, brands and websites with people like you.
    Follow us:
    Let’s get started
    We'd love to hear about your project.
    © 2025 babarilyas. All rights reserved.