Permalinks structure are very important in SEO and have to be seriously dealt with. The best is making use of SEO optimized permalinks which can boost website ranking on search engines. Here at techblogng.com we make use of the custom month and year permalink before (for example https://techblogng.net/2016/05/web-design-tips-for-a-pro-website.html), this permalink contains year, month and post name but I now think of using post name only to make it https://techblogng.net/web-design-tips-for-a-pro-website/. If you open the two links in your browser you will notice they are going to the same page on this website. That is exactly what I want to teach you today, and it is known as 301 Redirect.
A 301 redirect is a permanent redirect which passes between 90-99% of link juice (ranking power) to the redirected page. 301 refers to the HTTP status code for this type of redirect.
The 301 redirect is just for redirecting old permalinks to new permalinks, telling the browser the article have been permanently moved to another url. This is very important after changing permalinks because some websites might have linked to those pages/posts on your own blog, so to avoid the visitors from landing on 404 error page the browser will automatically redirect them to the new url. Once you perform the 301 Redirect, there is no need of worrying about loss in traffic from search engines. Your search engines visitors will be automatically redirected to the new url and search engine will also start updating the permalinks till everything is completely set.
Now, I know what you want to ask is how can the 301 Redirect be done. Don’t be in a hurry, I will explain everything to you.
Note: The below guide is useful for those that want to change from any permalink structure to post-name permalink structure only.
How to Change Permalink Structure
Changing WordPress Permalink is very simple, all you have to do is;
1. Visit WordPress Dashboard.
2. Go to Settings >> Permalinks.
3. Now change your permalink structure to the new one you want and save changes. For this tutorial choose the post name option i.e. (https://techblogng.net/sample-post/)
How to Create 301 Redirect for All WordPress Posts
1. Generate Redirect Code from Yoast Permalink Redirect Generator.
2. While on the page, input the url of your website. If you installed your wordpress in sub-folder input the subfolder otherwise leave it empty. And finally choose you old permalink structure.
3. After all field have been taken care of appropriately, click on the Generate Redirect Button.
4. There you have the code. Now Paste the redirect code into your .htaccess and test whether it’s working. Add the redirect code to the the top of your .htaccess file.
NOTE: Make a backup of your .htaccess file before editing it.
How to Locate and Edit .htaccess file
Editing .htacess is very simple but care must be taken while editing it because any mistake there can cause your website close down. .htaccess file can be editing from file manager and from wordpress dashboard.
To edit it from file manager; locate .htaccess file in the root of your wordpress install and edit it. You may need to allow access to show hidden file before you can see the file.
To edit from Dashboard; Instal SEO plugin by Yoat. Go to SEO >> Tools >> File Editor and make any changes you want then save.
If you have any problem or any question, feel free to submit them and I will reply as soon as possile.