Are you looking to redirect your WordPress page to another URL? If yes, you landed in the right spot. If you don’t know how to add redirects to your website then this guide can help you.
Redirects can help your site recover from dead links, pages not found, and 404 errors. By using this, you can redirect all your visitors to the current or new page. It not only enhances user experience but also improves your search engine rankings.
In this blog post, you will learn how to add redirects in WordPress by using plugins and without using plugins. We will discuss different methods with easy steps.
In today’s guide, we will see what is a redirect, why you should use it, the different types of it, and how you can create redirects in your WordPress blog.
What is a Redirect in WordPress?
A redirect in a website is a process of automatically directing a user from one web page to another, usually under a different URL. Redirects are often used to send users to a new page after a certain event has occurred, such as a successful login or signup.
Redirects can also be used to direct users to different versions of a page based on their device or location.
There are different types of redirects like 301, 302, 307, and other redirect types. We will see all types of redirects later in this post.
Types of Redirects in WordPress
To understand the working of redirection, first, we need to understand the types of errors that we can use on our website. Here are some of the major redirects you can use:
- 301 Redirect: A 301 redirect is a permanent redirect from one URL to another. When a browser makes a request for a URL that has been redirected, the server will respond with a status code of 301, indicating that we have permanently moved the page to the new URL.This type of redirect is used by the majority of webmasters because by using it, you ensure that your SEO performance will not hurt and your search engine rankings will not move down.
- 302 Redirect: A 302 redirect is a temporary redirect often used when a website is temporarily down or undergoing maintenance. By redirecting users to a different location, the website can ensure that they still have access to the content they need.
- 303 Redirect: A 303 redirect is an HTTP response code that indicates that they have moved a resource to a different location. They typically specify the new location in the Location header of the response. A 303 redirect is sometimes also known as a “See Other” redirect.When a client (e.g. a web browser) makes a request to a server, the server will respond with an HTTP status code. If the status code is a 303 redirect, the client will know that the resource has been moved and will automatically fetch the resource from the new location.
- 307 Redirect: This is also a temporary redirect and very similar to the 303 redirect type. We can say that this is a more advanced version of 302 temporary redirects.We often used them for resources that have moved temporarily, such as when a website is down for maintenance. Also, 307 redirects use the same method to send and receive information.
- 308 Redirect: A 308 redirect is the same as 303 and 307 redirects, but it is a permanent redirect type. Developers or programmers widely used it in comparison to WordPress blog owners.
Why Use Redirect in WordPress?
There can be numerous reasons why you want to use a redirect in your WordPress blog. It might be you are moving to a new domain, or have recently deleted any page from your site. Also, not using redirection in WordPress can cause tons of 404 errors that hamper the user experience.
Here are some of the primary reasons why you use redirect in WordPress:
- URL Optimization: To better optimize your website for higher rankings, you perform various On-Page optimization and URL optimization is one of them. While analyzing your site, you may find unorganized or non-optimized URLs that need to be optimized. But, redirecting old URLs to new URLs is very important so that your visitors who might have bookmarked your pages don’t get 404 errors.
- 404 Errors: Next, we have one of the major technical errors faced by webmasters. This error occurs when the requested page is not available on the website. You can simply redirect all 404 errors to a live page using 301 redirects.
- Domain Changing: I have seen people moving their website to a new domain or directory. The reason can be security reasons or general website reorganization. It is very important to add proper redirect when moving domains so that your visitors are redirected to the right place.
- Content Updation: If you have a very old website with hundreds or even thousands of pages then you might look for old pages that are no longer generating any traffic to the site and decide to delete them. But, after deleting them, you have to add a proper redirect to move all deleted pages to other live pages on the site.
Apart from the above reasons, there can be other reasons behind adding redirects to your website. But, while doing the redirect process, keep ensuring that you use the right redirect type and page URL. We will see how you can add pepper redirect in WordPress later in this post.
How to Redirect WordPress Page to Another URL
There are several methods we can use to redirect a WordPress page to another URL. All of these methods are easy to perform, even beginners can perform these methods. I will show you how you can add a redirect in WordPress using:
- .htaccess file
- Functions.php file
Let’s jump into the methods.
How to Redirect WordPress Page Using Plugin
The first method to redirect a WordPress page is by using a free plugin. It is one of the fastest and safest ways to redirect any page to another URL.
This method is for those individuals who don’t want to edit any of their site’s files. In this method, you simply install a plugin and set up redirects in a few clicks.
There are plenty of redirection plugins available on WordPress but I highly recommend two plugins:
Let’s see both plugins one by one.
It is one of the oldest and most popular plugins that helps you manage all your redirects in one place. It is also trusted by more than 2 million WordPress users.
To install this plugin, go to Plugins > Add New and search Redirection in the search box and simply install and activate the plugin.
Now, after successfully installing the plugin, navigate to Tools > Redirection from the left sidebar in the WordPress dashboard as shown in the above image.
Once you click on it, you will get a Basic Setup screen with some options that you can enable. For example, you can store logs of all redirects with IP information and you can also enable the option to create an auto-redirect whenever you change any permalink on your site.
Now, once you complete the setup process, you can create new redirects in your WordPress blog. To get started, click on Redirects and add the source URL and target URL as shown in the above image. To save your new redirect, click on the “Add Redirect” option.
Moreover, if you click on the setting icon, you will get more settings like you can select the match style of the URL and can also choose the type of redirect. With this step, you have successfully added a redirect to the WordPress page.
It is another excellent plugin that allows you to manage all your redirects in WordPress. The process of installing this plugin is the same as we did for the above plugin.
After successfully installing the plugin, navigate to Settings > 301 Redirects as shown in the above image.
Once you click on it, you will see a screen where you can create redirects by simply entering the old page URL and the new page URL. You can also choose from 301, 302, and 307 redirect types.
This plugin also allows you to edit and delete your redirects. Moreover, you can also check the number of hits received on your redirects.
How to Redirect WordPress Page Using cPanel
In this method, you have to use your web hosting’s cPanel. If you don’t like installing too many plugins on your WordPress blog, you can use this method.
To get started, log in to your cPanel by entering your username and password.
Once you log in to your cPanel, visit Redirects under the Domains section as shown in the above image.
Once you click on it, you will get some options to add redirects. Here, you have to choose the redirect type (301 or 302), select your domain, enter both URLs, and at the final step, choose whether to redirect with or without www or only redirect with the www version of the page.
You can check all your redirects on the same page and can also delete any redirects you want as shown in the above image.
How to Redirect WordPress Page Using .htaccess File
The next method to redirect the WordPress page to another URL is to edit the .htaccess file of your website. This method involves editing the site’s critical backend file that why I highly recommend you to backup your WordPress blog before starting.
Now, login to your cPanel and open File Manager available under Files as shown in the above image.
Next, go to the public_html folder and edit the .htaccess file by right-clicking on it and choosing Edit.
Once you open the .htaccess editor, copy the below code of line for 301 permanent redirects and paste it into the .htaccess file.
Redirect 301 /old_page /new_page
In this line of code, you have to replace /old_page with the old page URL that you want to redirect and /new_page with the new page URL that will replace the old page.
For example, if you want to redirect your /articles page to your /blogs page, you have to paste this code:
Redirect 301 /articles /blogs
Note: You don’t have to paste the entire page URL when doing redirections for the same domain. But, if you are redirecting pages from different domains, then you have to paste the entire page URL like Redirect 301 /articles https://example.com//blogs
Once you save your .htaccess file, your old page will successfully redirect to the new page.
Whether you are moving to a new domain, want to optimize your old URLs, or looking to fix broken or 404 links to improve your site’s SEO, the above guide surely helps you redirect an old page to a new page.
We have discussed different methods to implement redirects in WordPress. You can use any of them as per your preference. But, I highly recommend going with the plugin method as it is one of the fastest and easiest ways among others.
I hope you found this tutorial helpful and easy to follow. Still, if you have any doubts, feel free to comment below your questions, I will try to answer all of them.