Fix 404 Errors After Changing WordPress Permalinks

| WordPress
How to fix 404 errors from changing permalinks to post name

One of our Pro members was wondering if he'd lose search engine ranking after he switched his permalinks settings.

This tutorial will show you how to redirect the old permalinks to the new ones, so that you don't get 404 errors. You'll maintain your search engine rankings, as well as keep users happy.

Step #1. Document your current permalink settings and URLs

  • Either write down or take a screenshot of your current permalink settings. You'll need this in the next step.
  • If you're using the "default" setting, you can skip steps 2 and 4, since WordPress will automatically redirect for you. You'll still need to do steps 3 and 5 though.

Here's my test site as an example:

Fix 404 Errors After Changing WordPress Permalinks
  • Also, write down some of your current URLs so you can test them later.
  • Try to get at least 10-20 URLs. When you test the URLs, you'll feel confident that everything went well.

Step #2. Create the redirect code

  • Go to this URL and fill out the short form with your site information:
  • You'll then get a redirect code. Copy that line:

Step #3. Switch the Permalinks setting

In your wp-admin:

  • Switch the permalinks setting to "post name".
  • Save.
  • After this step, you'll get 404s for your old links. For example, search engine results will give you a 404 error, as well as any links that aren't dynamically generated.

Step #4. Apply the code

Now let's get the 404s fixed.

  • Use your host's file manager or SFTP to edit the .htaccess file in your WordPress root folder.
  • Paste the code from step #2 in it. You can add it just after the "# END WordPress" line on a new line.
  • Save the file.

Step #5. Test and test some more

  • Finally, test your URLs from step #1 to make sure they redirect properly.
  • Also, you can search your site in search engines and see if those URLs redirect properly.

Step #6. Celebrate

That's all there is to it. You've now successfully changed the permalinks on your WordPress site and also redirected the outdated links. Congrats!


About the author

Nick is the Director of Support at OSTraining and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.