Setting Up 301 Redirects In WordPress
If you’re looking to move domains or changing the URL structure of pages within your website. It’s a best practice to set up 301 redirects to make sure the SEO done on your website stays in tact.
The good thing about WordPress, is that there’s always more than one way to skin a cat when it comes to doing certain things with your website. Completing 301 redirects are one of those things that offers different situations. I’ll offer a few simple fixes so you can get to transferring/changing your website.
I know you’re probably asking “what is a 301 redirect?” A 301 redirect is permanent URL redirection, where as a 302 redirect(commonly used by administrators or people who don’t know anything about search engine optimization) is a temporary redirect. While a 301 redirect lets viewers and all the search engine bots know that the content should now be directed to the new site and it is the authority on said information compared to the older page, the 302 redirect tells the search engines that this page is temporary and the older page the bot has run through, will be coming back and therefore passes no page authority you may have earned from the original changed page.
So let’s learn how to make 301 redirects work within the WordPress CMS while learning to make your site easier to read for search engine spiders.
Adding 301 redirects to the .htaccess file
To manually add the 301 redirects to your .htaccess file, you must know what the correct syntax is first. The correct way to do a 301 redirect is:
redirect 301 /oldpage.html http://www.site.com/newpage/
The above example is redirecting oldpage.html to http://www.site.com/newpage/. This is the correct way to do a 301 redirect when editing your .htaccess file.
Here’s how to correctly place your new 301 redirect syntax into the WordPress .htaccess file. Open your .htaccess file, and refer to the image below:
The above picture is the easiest way to remember it for myself. Creating a space for my redirects keeps me in check and ensures a clean .htaccess file so if there’s ever any bugs, I can quickly diagnose the issue.
Using a WordPress plugin to add 301 redirects
Another way to quickly add 301 redirects to your website is by using a WordPress plugin to quickly add the change directly within the WordPress admin section. That specific plugin is WordPress SEO by Yoast. The image below is exactly how you would do it, and is by far the easiest way to get into your .htaccess file to make these changes.
By clicking on edit files in Yoast, it takes you directly to the .htaccess file, once you see the .htaccess file, edit like you would the manual way shown above.
Finally, there are a few WordPress plugins that are a little more technical but solely handle 301 redirects on your website. Those can be found here: WordPress 301 Redirect Plugins. Personally, I wouldn’t recommend these unless you’re more experienced with WordPress, as the two examples above take care of the 301 redirect issue pretty thoroughly.
Using a 301 redirect is only part of establishing a solid search engine optimized foundation for your website. This rule is easy to master, and should be the end all be all when when it comes to making changes to pages or creating new pages on your website. Normally, when an SEO Consultant is hired on to work on your website. This is one of the first established practices they begin assessing on your website. It’s considered extremely important to make sure that everything on your website can be viewed and understood correctly by search engines that will be reading it.
If you have any questions in regards to how to correctly set up a 301 redirect, feel free to leave a comment!