Sooner or later, you will have to redirect users to a different post or a page. Reasons behind that might be different but when you decide that redirect is needed, you will have to take care of the way search engines recognize your new page.
One of the cleanest ways of permanently redirecting a post/page in WordPress is 301 redirect via .htaccess.
By creating a 301 redirect, you’re telling your web server and search engines that the page has been moved for good and that you’re only going to use your new URL and its content. This may help your SEO and will definitely get you more traffic if done correctly.
Redirect a post/page:
So, if there is only a page or several of them which you want to redirect permanently, use your .htaccess file for the job. This can be done only if you’re running your WordPress website on Apache server. Be sure you can view hidden files and folders because .htaccess is usually hidden. If there is no file, you can create one before continuing:
- Navigate to .htaccess or create one
- Open the file and then copy/paste this code into it:
- Modify the code and change paths to a post/page which you want to redirect
- Save changes
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html
That one line of code will take the first address (the old page) and redirect it to the new one. Simple as that. Search engines like Google will take that note and index the page correctly so that your future visitors can get only the new content instead of ending up lost.
Example: Redirect author archive page:
In one of our previous articles, we showed you how to redirect an author archive link. Instead of leading you to archive pages, the code from that article leads a user to a new destination instead of showing the author pages. Still, if you type the URL in your browser directly, author archive pages would show up – unless you redirect the entire page somewhere else.
To follow the same example, you can permanently redirect author archive page to about me page via .htacces:
Redirect 301 /author/john http://www.yoursite.com/about-me
If you have the need for multiple 301 redirects and you are planning on regularly redirecting your WordPress pages, modifying the .htaccess file might get less efficient. Instead, we recommend using a 5sec Redirect which will take redirection to a whole other level and make it much more user-friendly.