// wordpress & cpanel how-tos
WordPress permalinks not working after migration? Fixing the problem
You moved your WordPress site, and now every post returns a "404 Not Found" page, or your links show an ID instead of the post name. Don't worry: it's one of the most common problems after a move to a new server or host, or after reinstalling WordPress.
Why permalinks break
Pretty permalinks like /my-post-name/ don't exist as real folders. WordPress relies on rewrite rules, stored in the .htaccess file on Apache and LiteSpeed servers, that send every request to index.php. If .htaccess didn't come with your migration (hidden files are easy to miss), or the new server can't write it, your posts return 404 errors.
Before you start, check that you can log in to cPanel and edit files. Some hosts limit file permissions for security; if you can't edit files, ask them to correct that.
1. Reset your permalinks
Log in to your WordPress dashboard and go to Settings → Permalinks. Check that the selected structure is the same one you used before the move, then click Save Changes. WordPress regenerates its rewrite rules and writes them to .htaccess.
Keep exactly the same structure as before. If your old URLs included the category and you switch to another format, you'll lose rankings and break your backlinks. For a new site, Post name is clean and easy to read for both people and search engines.
Refresh your browser and open one of your old posts. In most cases, it works again.
2. Restore the .htaccess rules manually
If your server doesn't let WordPress write the file, add the rules yourself. In cPanel, open File Manager, enable Show Hidden Files in Settings, and open your site's folder. Edit .htaccess (or create it if it's missing) and add this default WordPress block:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPressIf WordPress is in a subfolder, like /blog/, change RewriteBase / to RewriteBase /blog/ and the last line to RewriteRule . /blog/index.php [L]. Save the file, then save your permalinks once more in the dashboard. If you only have FTP access, see how to use FileZilla with WordPress.
On an Nginx server, .htaccess does nothing, and your host has to add the rewrite rule to the server configuration.
3. Clear your caches
If you use a CDN like Cloudflare or a caching plugin, it may keep serving the old error pages for a while. Purge the cache in your CDN account and in your caching plugin, then test again in a private browser window.
Still getting 404 errors?
If you've tried all of this and your permalinks still return 404 pages, the problem is on the server. Contact your host, explain that you reset the permalinks and the .htaccess rules, and ask them to check that mod_rewrite is enabled and that AllowOverride lets your .htaccess work. A good host fixes it quickly. If yours doesn't, compare hosts in my list of the best WordPress hosting for blogs.
FAQ
Why do my WordPress posts show 404 after migration?
The rewrite rules in .htaccess are missing or can't be written on the new server. Go to Settings, Permalinks, keep your old structure and click Save Changes, or add the default WordPress rules to .htaccess yourself.
What is the default WordPress .htaccess code?
It's the block between # BEGIN WordPress and # END WordPress that turns on mod_rewrite and sends every request that isn't a real file or folder to index.php. Copy it from this guide or from WordPress's own documentation.
Should I change my permalink structure after moving?
No. Keep exactly the same structure as before, or every old URL changes and you lose rankings and backlinks unless you redirect them all.
SOURCES
Prices and limits change. We note the date we checked each one; confirm on the provider's site before you buy.