Technology

How to redirect WordPress

We’ve all heard about redirects, have been redirected or wanted to do redirecting ourselves. Although they can have somewhat of a bad rep thanks to shady links that will often redirect you to spam pages, redirects are a standard and very useful practice done by everyone who wants to have a properly-working, reliable and SEO friendly site. 

The most common use of redirects is after making changes to your site’s design, structure or content. Since websites are very prone to changes, using redirects on sites big and small is a very common occurrence. Redirects also have a reputation of being difficult to implement which can make people feel intimidated even by the thought of doing redirects. This only leads to negative effects on the SEO of their site or additional costs for hiring someone to do redirects for them. 

Ending up in either of these situations is completely unnecessary considering how fast and easy it is to do redirecting nowadays, especially on WordPress sites. Since you are reading this article, it’s safe to assume that you have made the right call and decided to ditch the fear of redirecting, take matters into your own hands and do the job yourself. That’s great and we’re here to help you out. In this article, we will talk about what are redirects, the different types of redirects, why we use them and how they are implemented.

What are redirects and why we use them? 

There is really not much complexity behind the word redirect. Similar to in real life, redirecting on websites means pointing someone from their initial destination (URL) to an alternative one. Now, why would you want/need to do this? Remember the changes in website structure, design, and content we mentioned earlier? 

Those changes can involve updating your permalink structure, moving to a new domain, deleting/moving/replacing/merging pages or pieces of content, switching from HTTP to https, and a lot of other things that will cause broken links internally and externally. Besides irritating and disappointing your visitors, broken links will cause a deterioration of your site’s online reputation and search engine rank. One of the ways search engines determine the level of SEO a site has and what rank in the search results it deserves is by sending their bots to crawl it. 

If one of those crawlers doesn’t find a page in a location it is supposed to be in and ends up on a 404 page instead, that will mean automatic negative points for both your SEO and your SERP rank, a situation you should avoid at all costs.

Links that are broken internally can be fixed without redirecting since they are on your own site, but you have to bear in mind that fixing every broken internal link might end up being a very time consuming and tiring endeavor. When it comes to external links, you can try contacting the administrators of the sites displaying the broken links and ask them to fix them but without any guarantee that they will be willing to do that. So in both cases, redirecting is the way to go. Through redirects, you will be setting up rules for where external and internal links pointing to your former pages should be pointing to from now and with that stopping your visitors from ending up stranded on 404 pages and your site from seeming poorly made

Types of redirects

When it comes to WordPress sites or any other type of site, there are 5 different types of redirects.

301 redirects

This type of redirect is by far the most used type. They are put in place when a change of URLs is permanent, meaning that the old page/site/post won’t be coming back and its URL won’t be used again.

302 redirects

302 redirects are basically the opposite of 301 redirects. They are put in place when a change is only temporary and you are sure that within the next 6 months the old page/site/post and its URL will be up and running again. 302 redirects come in very handy when a site/page is under maintenance, when you want to have seasonal/temporary content and for doing A/B testing.

303 redirects

303 redirects are used when you want to signal that the visitor is being redirected to a different site/ service, for example, during online payments when you redirect a customer to PayPal. A 303 redirect will block the resubmission and refreshing of a page and will not allow for the page to be cashed or bookmarked. 303 redirects are also a temporary type of redirect.

307 redirects

A 307 redirect is essentially a twin of the 302 redirects. In fact, the 307 redirects was created with the aim to be 302’s replacement but is still not used as frequently because not all servers will support it. The only major difference between the two redirect types is that the 307 can also make sure that when a POST request method is redirected, it won’t be changed.

308 redirects

This type of redirect is able to do the same perseveration of POST request methods like 307 redirects but unlike them, 308 redirects are also permanent. Basically, you can think of a 308 redirect as a fusion between a 301 and 307 redirect.

Methods of implementing redirects

Now that you know what redirects are and which types you have on disposal, it’s time to teach you how to actually start implementing them on your site. You can go in one of two routes, a more technical route using the .htaccess file or the simpler route using a plugin.

The .htaccess file method

You should use this method if you have at least a general knowledge of how to make adjustments to code because as we all know, making even the smallest mistake in a line of code can cause big problems in the functionality of a website.

To find the .htaccess file you will first need to connect to your WordPress site through an FTP client. After doing that, you should be able to see the file in the root directory of your WordPress installation.

Once you’ve found the file, use any text editor of your choice, it can even be Notepad, to start writing redirect rules. Your redirect rule will consist of the redirect type, the URL of the old page/site, followed by the URL of the new page/site.

Here’s an example of what it might look like.

“Redirect 302 /previous-page.php https://www.yoursitename.net/new-temporary-page.php”

The structure of the redirect rules will vary depending on if you’re redirecting an entire site, just one page, etc..

Redirect rules are usually placed at the end of the .htaccess file and after placing them, the last thing you need to do is save the file and your redirect has been implemented. 

A word of advice, if you are using this method to implement a more than few redirects, it’s best to backup the .htaccess file before making any changes, just to be safe.

The plugin method

This is the less risky and less intimidating method of setting up redirects and the one we would advise you to use especially if you don’t possess any technical knowledge.

First, you have to decide on a plugin. Our recommendation is WP 301 Redirects. This plugin will closely monitor all changes in the URLs of your posts and pages and will set up a redirect rule automatically after a change has been made. This plugin also comes with protection against bad bots, which will turn off automatic redirects for any bad bots headed to your site. Another great feature of this plugin is the built-in charts that will show you all the information on your site’s traffic and with that remove the need for tools like Google Analytics completely. Even though this plugin is as easy to use as it can be, it will still come with support directly from the creators of the plugin who are ready to assist you with any issue you might have. Now let’s see how redirects are set up using the WP 301 Redirects plugin.

Step number one is installing the plugin which is done through the plugins section in your WordPress dashboard. When the plugin is installed, go into the settings and then the 301 redirects section to begin the process.

In the 301 redirects section, you’ll have two input fields, one for the URL you want to redirect from and another one for the URL you want to redirect to.

Next to the “redirect from” input field, will be a spinner box using which you choose the type of redirect you want to set up.

A great aspect of this plugin is that it will also present you with drop-down menus containing all the pages from your site, so in case you want to redirect from/to one of those pages, you can just select it without having to type anything in.

The last thing left to do is to save your redirect rules and you’re done. Your redirects are implemented with no hassle, no confusion and most importantly no code involved. One thing we also have to mention about this plugin is that it allows setting up redirect rules in bulk by uploading them in a CSV file, a very handy feature when you have the need to set up more than just one redirect.

Conclusion

And with that we’ve come to the end of this article, we truly hope it was helpful in providing you with some basic knowledge on redirects and teaching you how to set them up on your own. As you saw it’s nothing complex or intimidating, it doesn’t take too long to do regardless of the method you use but it plays such a big role in the UX your site provides and the online reputation it has. Don’t fear it, don’t postpone it and start redirecting today. Trust us, you’ll be happy you took that advice.