Welcome to our comprehensive guide to WordPress page redirects! In this article, we’ll be exploring the ins and outs of redirects, why they’re important, and how you can easily set them up on your WordPress site.
Whether you’re a solopreneur looking to organize your content more effectively or a business owner seeking to improve your website’s SEO and increase conversions, this guide has something for everyone.
We’ll be covering both manual and plugin tutorials, so you can choose the option that works best for your needs. We’ll also discuss the different types of redirects available and how to use them effectively.
What are redirects?
A redirect is a server-side mechanism that sends users from one URL to another. Redirects can be useful for a variety of reasons, such as when you want to send users to a new page because the old one is no longer available or relevant.
You may be familiar with the HTTP status code 404, which stands for “page not found.” Redirects can help prevent users from encountering this error by sending them to a new page instead.
For example, let’s say you have a page on your website located at http://www.example.com/old-page-name. But you decide to move your site to a new domain, so the page is now located at https://www.example.com/new-page-name. In this case, you would set up a redirect to send users from the old page to the new one. This way, anyone who tries to access the old page will automatically be redirected to the new one, ensuring they can still find the information they’re looking for.
Similarly, if you decide to change the name of a product on your eCommerce site from “green shirt” to “blue shirt,” you might want to set up a redirect from the old page name to the new one. This ensures that users who are searching for the product by its old name will still be able to find it on your site.
Why should you use redirects on WordPress?
There are many reasons why redirects on WordPress can be valuable, including:
- Organizing your content: Redirects can help you organize your content more effectively by allowing you to move pages to new URLs or change their names without breaking links or causing confusion for your users.
- Improving SEO: Redirects can improve your WordPress website’s SEO performance by helping you avoid broken links, which can negatively impact your search rankings. When you set up a redirect, search engines will know to follow the new URL, ensuring that your site is properly indexed and ranked.
- Increasing conversions: Redirects can help increase conversions by making it easier for users to find the content they’re looking for. If a user clicks on a link to a page that no longer exists, a redirect can help them find the new page and keep them on your site.
Redirects are also useful if you’ve changed the URL structure of your site or moved it to a new domain. In these cases, redirects can help you maintain your existing traffic and avoid losing users who may not be able to find your site through its new URL.
Types of redirects
There are several different types of redirects that you can use on your WordPress site. The most common types are 301, 302, and 307 redirects. Here’s a brief overview of each:
- 301 redirects: This is a permanent redirect to signify that the old page has been permanently moved to a new URL. They are often used when you move your site to a new domain or change the URL structure of your site.
- 302 redirects: These redirects signify that the old page still exists, but it should be accessed using a different URL. They are often used when you want to temporarily redirect users to a new page or when you want to test a new page without affecting your SEO.
- 307 redirects: These redirects signify that the old page has been temporarily moved to a new URL. They are similar to 302 redirects, but they are more specific and are often used when you need to temporarily redirect users to a new page for a specific reason.
When deciding which redirect type to use, it’s important to consider the purpose of the redirect and the intended duration. For example, if you are moving your site to a new domain and the old page is no longer available, you should use a 301 redirect. On the other hand, if you are testing a new page or temporarily redirecting users to a new page for a specific reason, you should use a 302 or 307 redirect.
When to use redirects
When should you use redirects on your WordPress website? Here are a few situations in which you might want to consider using redirects:
- When you’ve deleted a page or post: If you’ve deleted a page or post from your site, you should set up a redirect to send users to a destination URL with a relevant page or to your home page. This will help prevent users from encountering a “page not found” error and keep them on your site.
- When you’re updating or cleaning content: If you’re updating or cleaning up your content, you may want to set up redirects to ensure that users can still find the information they’re looking for. For example, if you’ve changed the URL of a page or post, you should set up a redirect to send users to the new URL.
- When you’re moving your domain: If you’re moving your site to a new domain, you’ll need to set up redirects to ensure that users can still find your site at its new location.
- When you’re dropping the “www” in your domain: If you’re dropping the “www” in your domain name, you’ll need to set up redirects to ensure that users can still find your site.
- When you’re enabling pretty permalinks: If you’re enabling pretty permalinks (often site.com/pretty-permalinks/) on your WordPress site, you may need to set up redirects to ensure that users can still find your pages and posts.
- When merging websites: If you’re merging two websites into one, you’ll need to set up redirects to ensure that users can still find the content they’re looking for on your new site.
- When changing your CMS: If you’re switching from one CMS to another, like moving from Wix to WordPress, you’ll need to set up redirects to ensure that users can still find your site and its content.
- When changing your URL structure: If you’re changing the URL permalink structure of your site, you’ll need to set up redirects to ensure that users can still find your pages and posts.
As you can see, there are many situations in which redirects can be useful. It’s always a good idea to check for broken or expired links on your site during your WordPress maintenance and set up redirects as needed. There are several tools available to help you identify broken links, such as Ahrefs’ Broken Link Checker and WooRank’s Website Review tool.
How do you create redirects on WordPress?
There are two main ways to create redirects in WordPress: using code or using plugins. In this section, we’ll cover both methods in detail.
Note: Using code to create redirects involves editing the .htaccess file, which contains important server settings for your website. This method is recommended only for experienced developers, as making a mistake while editing this file can cause major problems with your website. If you’re not comfortable editing code, it’s generally safer to use a plugin to set up redirects on your WordPress site.
Using a plugin to create redirects is generally easier and safer for most users. There are many WordPress redirect plugins available, each with its own set of features and capabilities. In the next section, we’ll discuss how to set up redirects in WordPress using both methods, so you can choose the option that works best for your needs.
Manual Redirection Methods with .htaccess
If you’re an experienced developer and are comfortable editing code, you can create redirects on your WordPress site manually by editing the .htaccess file. This file is located in the root directory of your WordPress installation and contains important server settings for your website.
To manually create a redirect on your WordPress site, follow these steps:
- Connect to your website via SFTP or your hosting control panel.
- Navigate to the root directory of your WordPress installation and find the .htaccess file.
- Download the .htaccess file to your computer and open it in a text editor.
- Add the following code at the top of the file:
Redirect 301 /old-page-name/ http://www.example.com/new-page-name/
- Replace “/old-page-name/” with the URL of the page you want to redirect and “http://www.example.com/new-page-name/” with the URL of the page you want to redirect to.
- Save the .htaccess file and upload it back to your server.
- Test the redirect by visiting the old URL in your browser. You should be redirected to the new URL automatically.
It’s important to be careful when editing the .htaccess file, as making a mistake can cause major problems with your website. If you’re not comfortable editing code, it’s generally safer to use a plugin to set up redirects on your WordPress site. In the next section, we’ll discuss how to set up redirects in WordPress using a plugin.
Manual redirection methods with wp_redirect()
Another way to manually create redirects in WordPress is by using the wp_redirect() function. This function is a WordPress core function that allows you to redirect users from one URL to another.
To use the wp_redirect() function, you’ll need to add it to your WordPress site’s functions.php file. Here’s an example of how to use the function to redirect an old page to a new page:
function redirect_old_page() {
if ( is_page( ‘old-page-name’ ) ) {
wp_redirect( ‘http://www.example.com/new-page-name/’, 301 );
exit;
}
}
add_action( ‘template_redirect’, ‘redirect_old_page’ );
In this example, we’re using the is_page() function to check if the current page is the old page we want to redirect. If it is, we’re using the wp_redirect() function to send the user to the new page. The 301 argument signifies that the redirect is permanent.
It’s important to note that the wp_redirect() function must be called before any output is sent to the browser. This is why it’s typically added to the template_redirect action hook, which is called before the template is loaded.
Using the wp_redirect() function is a quick and easy way to set up redirects on your WordPress site, but it’s important to be familiar with WordPress functions and how to edit your site’s functions.php file before attempting to use this method. If you’re not comfortable with coding, it’s generally safer to use a plugin to set up redirects on your WordPress site.
WordPress Page Redirection Using a Plugin
If you’re not comfortable editing code or don’t want to risk making mistakes while setting up redirects on your WordPress site, you can use a plugin to create redirects instead. There are many WordPress redirect plugins available, each with its own set of features and capabilities.
One of the most popular redirect plugins is the Redirection plugin. This plugin allows you to easily set up redirects on your WordPress site without having to edit any code. It also provides features such as error monitoring, redirect statistics, and automatic redirections based on URL patterns.
To use the Redirection plugin to create a redirect, follow these steps:
- 1. Install and activate the Redirection plugin on your WordPress site.
- 2. Go to Tools > Redirection in your WordPress dashboard.
- 3. Click the Start Setup button.
- 4. Choose whether you want to monitor permalink changes and keep a log of all redirects and errors. We recommend doing this to keep track of your redirects and create ones automatically when changing the name of a page. You can also choose if you want to store IP information for redirects and 404 errors.
- 5. Click Finish Setup and wait for the Redirection to show Complete
- 6. Click Continue, and on the Installation Complete Page, click Ready to Begin.
7. To create a new redirect, go to Redirects, and in the Source URL field, enter the URL of the page you want to redirect. In the Target URL field, enter the URL of the page you want to redirect to. Click the Add Redirect button.
- 8. Your new redirect will show up in the log.
The Redirection plugin makes it easy to set up redirects on your WordPress site without having to edit any code.
However, it’s important to keep in mind a couple of things when using plugins. First, using plugins can increase the risk of issues with your site, such as compatibility problems or conflicts with other plugins. It’s always a good idea to carefully research and test any plugins you use on your site to ensure that they work as intended and don’t cause any problems. Second, the ability to create redirects that aren’t 301 redirects is a paid feature on Redirect Pro.
Regardless, you should always be checking whether your redirects are working and if some have become outdated.
Why you should do regular website checks and maintenance
Regular website checks and maintenance are essential for any WordPress site. Failing to regularly check your website for errors can make your site less trustworthy to users and can negatively impact your search engine rankings.
There are several key factors that you should check during your website maintenance:
- Links: Broken links can be frustrating for users and can negatively impact your SEO. Use a tool like Ahrefs’ Broken Link Checker or WooRank’s Website Review tool to identify and fix any broken links on your site.
- Pages: Make sure all of your pages are functioning properly and are up to date. If you’ve deleted a page or post, make sure to set up a redirect to send users to a relevant page or your home page.
- Hosting: Make sure your website is hosted on a reliable server with fast loading times. Poor hosting can impact your site’s performance and user experience.
- Speed: Website speed is an important factor for both users and search engines. Use a tool like Google PageSpeed Insights to identify any issues with your site’s speed and take steps to improve it.
By regularly checking and maintaining your website, you can ensure that it’s functioning properly and providing a positive experience for users. This can help improve your search engine rankings and make your site more trustworthy to users.
Hire a Codeable expert for website health and redirects
If you’re in the process of maintaining your website’s SEO and need to set up redirects, consider hiring a Codeable expert to take care of them for you. Codeable is a platform that connects businesses with top-rated WordPress developers and designers.
Codeable experts are particularly equipped to help with website maintenance tasks like setting up redirects and scanning your site for bugs. They have the knowledge and experience to quickly and accurately set up redirects on your WordPress site, ensuring that your website is functioning properly and making changes with minimum downtime.
In addition, Codeable experts are available to help at a moment’s notice and can work with you for as long as you need them to. Whether you have a small project or larger, ongoing, maintenance and development need, Codeable experts can provide the support you need to keep your website running smoothly.
So, if you need help setting up redirects or want to ensure that your website is in top shape, consider hiring a Codeable expert..You can get started easily by posting your project, and a Codeable expert will confirm your needs and provide you with a cost estimate.