Are you looking to redirect a page in your WordPress website but unsure how to do it?
This article will help you redirect a page in WordPress both manually as well as by using a plugin.
What is a redirect?
To prevent the previous links from breaking it is important to redirect them to a new or updated page. By doing a redirect, your server is telling the visitor’s browser that the page has been moved to a new location and they should load the new page instead.
When it comes to redirects there are different types of codes that can be used. Each has a different purpose but the most common redirect is 301. This tells anyone visiting the previous page that this page has now been moved to a new address permanently. The 301 code is also the best choice for SEO. Few other redirect codes include 302, 303, 307 and 308.
When to redirect a page
There can be many reasons for redirecting a page some of which include:
- 404 errors:
If someone visits a page that doesn’t exist or that page has been moved to a new address you should redirect the visitors to a custom 404 error page.
- When permalink is changed:
Many times after a page has been published we might change the permalink for SEO reasons or to make it more readable. In those cases it’s important to redirect the previous permalink to the new one.
- Changing directories:
Many times we might change directories on our website for optimization or some other reason. We will need to redirect the previous pages to the new ones.
Redirecting using a plugin
Using a plugin is a simpler method in comparison to the other methods we will share below.
Redirection is the best plugin for redirection purposes. With over 1+ million active installs you can gauze it’s popularity.
Steps to redirect a page:
- Install and Activate the plugin.
- Visit Tools -> Redirection from your admin dashboard.
- In the Add new redirection section you can input your previous url in the Source URL text field and the new url in Target URL text field. The match drop down needs to be set to URL only and the Action drop down to Redirect to URL.
- Click the Add Redirection button and your redirect should be working now.
This plugin also has various other features. You can also find 404 errors that might be generated on your website.
Redirecting using .htaccess
It is important to carefully edit the .htaccess file as one wrong line of code can make your WordPress website inaccessible. You can use FTP to access the .htaccess file. It can be located in the root directory where other WordPress files are there.
Add the below line of code at the bottom for adding the redirect to your website.
Redirect 301 /your-old-url/ http://website.com/new-url/
In The End
No matter what your reason is for redirection the above methods should help you redirect your pages easily. Using a plugin is a better and convenient option if you are unsure about editing the .htaccess file. It is also best to do a 301 redirect.