In this tutorial, you will learn what is redirect, why it plays an important role and how to make a redirect in WordPress. You will also figure out when it’s necessary to make a redirect on your website.
What is WordPress redirect
Your browser usually does redirect from one page to another when you have a need to change your domain or site address. It allows users of the site or search engines to use the old address of your website. Redirect also helps not to lose all external links pointing to the old domain.
Types of WordPress URL redirect
There are two main types of redirects:
- permanent (301)
- temporary (302, or sometimes 307)
The numbers in parentheses are the codes used in the HTTP protocol for redirection. However, in this tutorial, we will talk only about the 301 redirects in WordPress.
Sometimes there is a reason to move your website to another page, with the new address. In this case, you’ll have the need to either notify all the users about this or make a redirect. If you refuse to create a redirect, it will cause the 404 not found error. Such error may lead to the loss of ranking in search engines.
How to create a 301 redirect in WordPress
With the 301 redirects, you get two results:
- You inform the search engines that “http://exemple.com” and “https://example.com” is the same page. More precisely, you move the page from “http://exemple.com” to “https://example.com” and ask to transfer the entire link weight.
- All visitors to the http-version of the page are automatically redirected to the https-version of the page.
WordPress URL redirect with plugin downloading
One of the ways to create a 301 redirect in WordPress is to do it with the help of plugins. However, this approach may cause a loss of speed while siteloading.
- Visit the admin dashboard of your website. Go to “Plugins” > “Add new”.
- In the search field type “Redirect”.
- Choose the first plugin named “Redirection” and click to install it. After that click the “Activate” button.
- Go to “Tools” > “Redirection”. In case you haven’t got this plugin before, you will be offered to set it up.
- Click on the “Start setup” button.
- Mark all the empty fields, in case you want to keep a log for all redirects and errors, and store IP information.
- Press the “Continue setup” button and finish setup.
- After that, you will be able to redirect the necessary pages or single post pages to a proper destination.
- Moreover, with the help of this plugin, you also can see the information on 404 errors.
WordPress URL redirect in .htaccess file
There are a large number of code options for redirecting from http to https with the help of .htaccess file. In this tutorial, you’ll learn how to make static and dynamic redirects.
The process of making redirects though the .htaccess file is structured and detailed. However, in this case, you don’t have to worry about slow siteloading.
- Firstly, you need to clear the WordPress cache. To do it simply download the WordPress Super Cache plugin.
- After that, go to the “Settings” > “WP Super Cache”.
- After that press the “Delete cache” button.
- Log in to the cPanel hosting.
- Open the “File Manager” tab.
- After that, the page with the WordPress folder structure will be opened.
- Go to “public_html” and then to the folder, which contains your WordPress installation.
- Find the .htaccess file.
We strongly recommend you create a backup to avoid the file loss and save your time, in case something goes wrong. You don’t need to make the whole website backup. It will be enough to save your .htaccess file on your computer or cloud.
Finally, you can proceed to the redirect creation. Open the .htaccess file. Here you can see two variants of the 301 WordPress redirect:
- Static redirect from one page to another
- Dynamic redirect from few pages to another
As a final step, save your .htaccess file. Go to the “cPanel” > “File Manager” > “public_html” and then to the folder, which contains your WordPress installation. Place the newly updated file in this folder. The job is done!
We hope you liked our simple tutorial on how to make a redirect to another page in WordPress. Subscribe to our newsletter for more useful tutorials and instructions.