It is relatively easy to launch or set up a WordPress based website, but what if your site getting popular and you are uploading more and more content. In this post How to Redirect a Page in WordPress, we will highlight the best and most effective ways to do redirects in WordPress using plugins and .htaccess file.
It will become harder for you to manage and run your website due to the increase of content and media such as images, which will slow down your website.
Often people neglect the broken links on their websites.
What about if some links on your website are broken or a page has been removed?
You would need to fix all broken links on your WordPress website ASAP as it might hurt your SEO ranking.
There are various plugins available on WordPress Repository, which can make this job very easy. Before we dive in and explore different plugins, we need to understand what is a page or post redirect in WordPress and why you would need to use redirects carefully.
What is a Redirect?
A redirect is a web server function which sends a user from one URL to another. Redirects are just an action which will take a user from one URL (old URL in case it’s no longer available or moved) to another URL (alternative to old URL a user visiting).
All redirects have their own HTTP codes which are in 300 range.
So before you create a redirect on your website you will need to know the following information:
- Both old address and new address
- Type of redirect
These redirects codes are not many and you will never use some of them, just remember below codes while setting up a page redirect in WordPress.
- 301 Redirect ( Permanent Redirect )
- 302 / 307 Redirect ( Temporary Redirect)
Majority of people use 301 redirects which is named after 301 HTTP response code. 301 redirect means a page or URL has been permanently moved. These HTTP codes inform search engines that whether a URL is moved permanently or temporarily.
You can read more about redirect and HTTP response codes on this Moz article.
Why Might You Need to Redirect Pages in WordPress?
To make things simple we are going to list all possible reasons, you might want to add a page redirect in WordPress.
- Someone made a mistake while creating the page and you want to change the spellings of URL.
- You want to use a keyword in your WordPress post or page URL.
- You are moving your blog to a new directory.
- Someone has linked to your website page and used a wrong URL. You might want to redirect that link to correct place.
- You have changed the page or post title because you don’t like it and want to change WordPress page or post slug.
As you can see, the list of reasons you might want to add a redirect is endless.
How to Find Broken Links or 404 Pages?
If you are using Yoast Plugin in WordPress, you can connect Yoast to your Google Webmaster Tools account. Alternatively, you can use Screaming Frog, which is the best software to find all broken links and other SEO issues.
After connecting your account, you will be able to find all 404 pages which Google knows. Place redirects for all 404 pages or broken links and redirect them to the most relevant pages.
How to Redirect a Page in WordPress using the .htaccess file?
Adding redirects using a .htaccess file is very simple, but if you find it difficult or just want to have a simple solution then jump to How to Redirect a Page in WordPress using Plugins section.
If you are interested in learning something new then keep reading.
A .htaccess file is a very simple and powerful file. It controls a lot of thing on your web server like, which directories and files and visible or accessible or what type of image compression will be used and a lot more.
A .htaccess file is located right in the root directory of your WordPress installation. You can access it using an FTP Client or you can edit this file directly using a service like cPanel.
Editing .htaccess file using cPanel
Most of the web hosting companies offer web hosting with cPanel and most probably your website hosting package also comes with a cPanel or similar solution.
So we want to show you how you can use cPanel to edit your .htaccess file.
- Login to your cPanel.
- Open the File Manager.
- While opening the File Manager be sure that it is showing hidden files.
- Open the file to edit as normal.
Editing .htaccess file using FTP
If you have access to your FTP account, you can follow below simple steps.
- Login using FTP credentials.
- Navigate to your website root directory where WordPress is installed.
- Download the .htaccess file.
- Make changes to the .htaccess file.
- Upload it back.
Note: Make sure you make a backup of this file before editing.
Adding Redirects to .htaccess File
Now you have .htaccess file to add redirects all you have to do is add the below line to it.
Redirect 301 Old-URL New-URL
You have to specify the old location and the new location. A more practical example is below:
Redirect 301 https://www.webwhistles.com/how-to-redirect-a-page-in-wordpress https://www.webwhistles.com/redirect-a-page-in-wordpress
You can even add redirects to folders as well.
All you need to do to check if your redirection is working is load the page you are redirecting. If it’s working correctly, you will be redirected to the new page.
How to Redirect a Page in WordPress using PHP?
WordPress is built using the world’s most popular web scripting language PHP. If you are WordPress developer and need to make a redirect from within a theme or plugin you can use PHP to make 301 redirects.
You can add a redirect to a PHP page using the below code:
header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.yournewwebsite.com");
Above code snippet will make a 301 permanent redirect which will advise search engines that you are using a 301 redirection. Make sure you place this code at the top of the page to ensure redirection works correctly.
How to Redirect a Page in WordPress using Plugins?
WordPress redirects plugins are the most commonly used plugin by webmasters. We all know that broken links are not good for your website overall ranking.
Redirects plugins can help you to fix those broken links by pointing the user to the right page. So instead of being disappointed by a broken link, they can browse the content from a new location.
Below we have listed some of the Best Redirects Plugins for WordPress that can save your website from such broken links.
WordPress Redirects Plugins
Yoast SEO Premium is a popular paid SEO plugin which is mainly used for the SEO for WordPress. Yoast SEO Premium comes with a complete section for redirects out of the box. If you are already using this plugin for SEO, you don’t need to install a separate plugin to manage your redirects.
You can connect this plugin with Google Webmaster Tools and the plugin will automatically grab all information about 404 pages which need redirects.
This plugin’s redirects section is fairly easy to manage redirects and you don’t need any additional coding skills. This plugin will smoothly manage all URL redirects which will improve your SEO ranking.
Redirection is a popular WordPress redirects plugin which has over one million active installations. This plugin makes it stupidly easy to monitor 404 pages and setup 301 redirects for them.
This plugin has a built-in mechanism which informs you about the orphan pages and broken links. This plugin can be very useful if you are planning to migrate your WordPress website to a new location or directory.
This plugin is available completely FREE and available in many different languages.
Quick Page/Post Redirect plugin is the best plugin if you are looking to redirects posts or pages to another post or page event external URLs. All you need to specify is the new URL and the redirects type. This plugin provides the ability to redirects custom post types as well.
Quick Page/Post Redirect plugin is divided into two sections Quick Redirects and Individual Redirects. Quick Redirects works with directly 301 redirects which can be used for broken links. Individual Redirects work with the page or posts which already exist on your website and you want to set up a redirect internally.
This plugin can be downloaded for FREE from wordpress plugins repository.
SEO Redirection plugin is a very powerful plugin which makes it easier to setup redirects. This plugin let you track all the 404 pages and offers an instant redirects setup for them.
This plugin is easy to use and comes with an intuitive interface. SEO Redirection plugin keeps logs of all 404 pages which you can check later on.
You can manage all settings from its setting page and have full control over your broken links.
Simple 301 Redirects is another redirects plugin which is easy to use and let you set up redirects easily. If you don’t want to lose the SEO ranking of any page while changing the domain, then you require a tool like this which only directs the traffic to the new location.
This plugin is easy to install and you can manage all 301 redirects settings from the settings page.
This plugin allows you to fix broken links or dead links by redirecting the visitors to the homepage or any custom created page. This plugin is easy to install and use.
All 404 Redirects to Homepage use 301 redirects thus improving the SEO ranking.
Safe Redirect Manager is an amazing addition to WordPress plugins repository. This plugin offers simple functionality to redirects pages and folders which already exists on your website.
You can redirects page or posts comfortably using the HTTP status code. Use can easily choose 301 or 302 redirect when creating a redirect.
Redirect is a very simple redirects plugin as compared to others and available for FREE from the WordPress repository. If you are looking for basic redirects functionality then this is the plugin to install which make it great for beginners who don’t know how to redirect a page in WordPress?
This plugin provides an easy drop-down option on posts or pages edit screen, from where you can manage redirects with few clicks.
Forty Four plugin lets you create simple 404 pages which are a substitute to your default 404 page which might people don’t want to see. 404 pages created through this plugins load fast because it uses its own assets to load the page than using your theme assets.
Later you can check the log for all 404 pages and set up 301 or 302 redirects.
If you are running a big website or blog, then you might have a ton of content which is outdated or not performing well. In this case, you might want to remove all those content. 301 redirects don’t work in this scenario as you want to inform users that content they are looking deleted permanently.
401 for WordPress plugin setup 410 redirects for all 404 URLs which inform the users and search engines that requested page has been deleted permanently. This plugin lets web crawlers skip those deleted URLs, thus preserving the SEO ranking.
You will need to add a 410.php file in your theme which will be used by this plugin to load custom message for users.
Redirects are very important for any WordPress website because it leaves a big impact on your SEO ranking so you should know, how to redirect a page in WordPress? Fixing broken links take some time but will bring fruit later on. Information provided in this article enables you to manage broken or dead links on your website. For newbies, WordPress redirects plugin will be very handy as they might not have a deep knowledge of redirects and how it affects their website ranking.
If you have any suggestion or question about this post, please don’t hesitate to comment below.