Are you trying to create a redirect in WordPress? Not sure what a redirect is and why it is important? Don’t worry, we have got you covered in this beginner’s guide to WordPress redirects, we will cover what a redirect is, how to create a redirect in WordPress, why do you need, and when you should use redirects.
Ready? Let’s get started.
What is a Redirect in WordPress?
A redirect is a way for your website to send a quick message to your reader’s browser and tell them that the page they want to visit has been moved, so their browser can automatically point them to the new page of your choice.
There are various different types of redirects such as 301 redirect, 302 redirect, 307 redirect, etc.
However to keep this article simple and useful, we will only cover 301 redirects as that’s the most important.
Let’s take a look at why it is important by understanding the use case.
When do you need a 301 redirect in WordPress?
The primary reason to use 301 redirects is when your site or a page on your site has been moved, and you want to point the user to a new page instead.
This article idea came to us when one of our readers asked us for a way to redirect users from an old post to a new post.
– You need to create a redirect when you are planning on deleting a post or page in favor of new content.
– You need to create a redirect when you are planning on changing the permalinks of your post or page.
Why? Because not creating a redirect will cause your users to see a 404 not found error. Which is not only bad for users, but it can also impact your site’s SEO and hurt your search engine rankings.
That’s when 301 redirects become very important.
It allows you to tell search engines and your user’s browser that the page they are trying to reach has been permanently moved to a new location.
This allows for all your old page’s traffic and backlink (SEO) strengths to be transferred on to the new page.
Now that we have covered the why and when of redirects, let’s take a look at how you can create 301 redirects in WordPress using the different methods that are available.
If you don’t like the video or need more instructions, then continue reading.
How to Create Redirects in WordPress (using Plugins)
An easier approach to create and manage 301 redirects is by using one of the many WordPress redirect plugins. This allows you to setup redirects without ever writing a single line of code.
The simplest way to add and manage redirects in WordPress is by using the Redirection plugin. Install and activate the plugin. Once activated, visit Tools » Redirection to setup your redirects.
Redirection plugin not only allows you to setup redirects, it also helps you find out 404 errors on your WordPress site. You can then redirect those URLs to an appropriate destination. See this tutorial on how to track 404 pages and redirect them in WordPress.
Sometimes you may want to keep a post/page, but redirect it to another post or page. This is where Page Links to comes in handy. This simple plugin adds a meta box on your post edit screen where you can enter the address of the new location where you want to send your users.
Another easy to use plugin is Simple 301 Redirects. As the name suggests, it makes 301 Redirects simple. Simply install and activate the plugin and then visit Settings » 301 Redirects to add your URLs.
Now while setting up 301 redirects using a WordPress plugin is easy, it has some minor performance setback. Based on your WordPress hosting provider, your WordPress redirects maybe a bit slower by some microseconds.
If you want to make your redirects faster, then you can do so by using the code method and .htaccess file.
Setting Up 301 Redirects in WordPress using .htaccess
Using the web server configuration file .htaccess, WordPress users can set up 301 redirects that are fast.
Please keep in mind that a small mistake in your .htaccess code can make your WordPress site inaccessible, and it may start showing Internal Server Error.
That’s why it is important that you backup your .htaccess file before making any changes.
To edit your .htaccess file, you will need to connect to your website using an FTP client. The .htaccess file resides in your WordPress site’s root directory.
If you can’t see your .htaccess file there, then you need to force your FTP client to show hidden files. (See why you can’t find .htaccess file on your WordPress site.)
You can edit .htaccess file in any plain text editor like Notepad.
Here is a simple redirect, where we are trying to send a user visiting an old post to a new post.
You can add the code above preferably at the end of your .htaccess file.
That’s all. We hope this beginner’s guide to creating WordPress redirects helped you setup redirects on your site.
You may also want to check out these 9 most useful .htaccess tricks for WordPress.