Are you trying to create a redirect in WordPress? Not sure what is a redirect and why is it important? Don’t worry, we have got you covered in this beginner’s guide to WordPress redirects where we will cover what is a redirect, how to create a redirect in WordPress, when is the good time and why do you need.
Ready? Let’s get started.
Their browser can automatically point them to the new page of your choice because 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.
There are various different types of redirects such as 301 redirect, 302 redirect, 307 redirect, etc.
We will only cover 301 redirects as that’s the most important to keep this article simple and useful.
Let’s take a look at why it is important by understanding the use case.
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.
When one of our readers asked us for a way to redirect users from an old post to a new post is the time this article idea came to us.
– 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. It can also impact your site’s SEO and hurt your search engine rankings, which is not only bad for users.
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.
By using one of the many WordPress redirect plugins an easier approach to create and manage 301 redirects. This allows you to setup redirects without ever writing a single line of code.
By using the Redirection plugin is the simplest way to add and manage redirects in WordPress. 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.
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. Your WordPress redirects maybe a bit slower by some microseconds, based on your WordPress hosting provider.
If you want to make your redirects faster, then you can do so by using the code method and .htaccess file.
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.