If you make changes to your permalinks, you will also want to create a 301-redirect. This redirects users and search engines automatically to the new location for the content.
For example, if you
- change permalink structure,
- rename a post category or tag
- rename a post and change the post permalink accordingly
you want people who have bookmarked this particular content, or search engines that have indexed it, to be automatically redirected to the new location when using the old permalink. This way your SEO doesn’t break, and your users will end up at the new place right away instead of reaching a 404-page.
How I make 301-redirects
I add the redirects directly in the .htaccess-file. Below is an example where I have renamed the “uncategorized” category to “articles” and removed the category “article”. I want both of these to be redirected to https://example.com/category/articles:
This code is added at the end of the .htaccess file, below any other code generated by pretty permalink settings, or a security plugin for example. Make sure to replace the permalinks in the example with your own.
- Make sure you know what you are doing! An error here can break your site. If you are unsure, check out any of the available plugins to do this for you. This WP Beginner article have a more thorough explanation on how to do this, and some plugin tips if you are not a developer.
- If you are a developer, and want to make changes like this in code, make sure you backup your .htaccess before making any changes and try the changes out on a stage site before pushing them to a live website.