Blog Menu

I write and curate content for Bluehost. I hope this blog post is helpful.
Are you looking at creating a blog, website or an online store? Bluehost has something for everyone. Get started today.

Key highlights

  • Implement 301 redirects in WordPress to retain SEO value and avoid frustrating 404 errors.
  • Set up 301 redirects using .htaccess, cPanel, PHP scripts or plugins like Yoast SEO.
  • Permanent (301) redirection preserves link authority and maintains a seamless user experience.
  • Regularly monitor your redirects and use tools to ensure they’re working effectively.

Introduction

Delivering exceptional service often means refining business processes to align more closely with customer needs and preferences. Similarly, your site may need to evolve to become more user-friendly, reflect your business’s current state or improve website’s performance.  

However, reorganizing a website can often result in broken links—lots of them. This is where a 301 redirect in WordPress becomes essential. Without it, visitors encountering 404 errors may feel frustrated and your website’s reputation could suffer.  

In this guide, we’ll walk you through setting up WordPress 301 redirects, explore their benefits and explain their impact on search engine optimization (SEO).  

What is a 301 redirect in WordPress?   

A 301 redirect in WordPress permanently sends traffic from one URL to another. It tells users and search engines that the original page has moved. It further guides visitors to the correct destination while preserving the page’s SEO ranking and authority. This prevents the dreaded 404 error (HTTP status code) and allows users to access your content.    

How to create 301 redirects in WordPress   

You have several options to pick from when setting up 301 redirects on a WordPress website. For example, you can edit the .htaccess file, use cPanel, write a PHP script or use a WordPress plugin.   

Method 1: Edit the .htaccess file   

Htaccess is short for Hypertext Access. A .htaccess file configures Apache web servers to behave in a desired way. (If you have a Nginx server, you’ll need to pick another method.)   

Here, we’ll use it to set up a 301 redirect, so the web server permanently redirects traffic to a different URL from the existing page.   

Editing a .htaccess file is a manual process, which means you can make mistakes. Therefore, ensure you create a backup of your entire website by copying all the files to a safe location beforehand. This way, you’ll have a restore point if something breaks.   

Here’s what you need to do to add a 301 redirect in WordPress using .htaccess file. For this example, we’re using Bluehost’s dashboard. If you’re using another host, some parts might look different, but the process is the same to create .htaccess redirect.   

  • Head over to your host’s user login page. Enter your username and password. 
Bluehost user login
  • Now, navigate to the left-side panel and click on the Hosting from the menu. It has a list of all your websites. Open the Settings page of the website you wish to manage. 
settings in hosting panel
  • Open the File manager from the quick links section. 
open file manager
  • The page below will be displayed. It lists all the files your WordPress website needs to run. Locate .htaccess file and right-click on it to edit. 
  • If a prompt appears requesting you to change the encoding options, continue editing without changing anything. 

Can’t find the .htaccess file?   

  • Ensure you’re in the public_html folder. You can find it in the folder list on the left column in the image above. 
  • Check that hidden files are visible. Open Settings from the top-right corner, check the Show hidden files (dotfiles) option and save the changes. 
  • If everything goes well, you’ll have the same view of the .htaccess editor as seen below. Add the following text after the last line: ‘# END WordPress.’
RewriteEngine On
Redirect 301 /old-content/ https://example.com/new-content/

Replace old-content with the original destination URL (old URL) and new-content with the new destination URL. Save your changes and close the editor. 

You have successfully created a 301 redirect in WordPress using the .htaccess file and can now check that it’s working in your web browser. 

Method 2: Use cPanel   

If you’d prefer not to risk issues with the .htaccess file, the cPanel method is a safer alternative. Here’s how to access and use it to create a permanent 301 redirect for WordPress websites.   

  • Access your hosting dashboard (we’re using Bluehost). Scroll down and open cPanel from the Quick links section. 
open cpanel
  • The cPanel page below will open. Scroll down to the Domains section and open the Redirects page. 
redirects in cpanel
  • The Redirects page should be visible now. 
redirects settings page
  • On that page, fill in the information for your redirect like this: 
    • Type: Select Permanent (301). 
    • Https?://(www.)?: Select your preferred domain
    • /: Enter the end of the original URL. This is the page you wish to deflect traffic from. For instance, if the URL is “https://example.com/old-content,” you would enter “old-content.” 
  • Redirects to: Enter the full URL of the new destination. 
  • Select the option to Redirect with or without www. and add the new redirect. 

Your 301 redirect should now be live. 

Method 3: Write a PHP script   

PHP is a server-side programming language and stands for PHP: Hypertext Preprocessor. Developers use it to build dynamic websites. Since it runs on the server, PHP offers secure 301 redirect implementations. 

Here’s how to create a 301 redirect in WordPress using PHP: 

  • Open the File manager of the website you wish to manage. Create a new file and name it “redirects.php,” as shown in the image below. 
  • After creating the file, right-click on it and select Edit. A file editor will launch. Copy and paste the following redirect code into the editor:
<?php
// OldContent.php  
header(“HTTP/1.1 301 Moved Permanently”);  
header(“Location: https://www.example.com/new-content/”);  
exit();  
?>

Change “OldContent” to the file name for the page you’re updating and “https://www.example.com/new-content/” to the new URL you wish to use. Save the changes and close the editor. 

  • To make sure everything’s working, go to your browser’s address bar, type in the old URL and press Enter. You’ll be redirected to the new URL you provided in the header function.    

You can also add this header function at the beginning of any PHP file you want to redirect instead of making a new file. Remember to ensure the redirect code takes the first line at the top.   

Method 4: Use the Yoast SEO plugin  

The Yoast SEO Premium plugin offers a convenient solution for setting up redirects. With its built-in redirect manager, Yoast lends a hand whenever you change the URL of a post, page or taxonomy, which could otherwise lead to those pesky 404 errors if not redirected properly.  

The redirection manager automatically generates 301 redirects when you delete or relocate pages, keeping your visitors seamlessly connected. 

Here is how to locate redirect manager in the Yoast SEO premium plugin 

  • Go to your WordPress dashboard. 
  • Navigate to Yoast SEO tab on left side panel and select Redirects. 
  • Now on the new page, select the type of redirect you wish to apply in the redirect manager. 
  • Enter the old URL that you want to redirect. You can use either the absolute URL (e.g., https://www.example.com/contact/) or simply the path as a relative URL (e.g., /contact/).
  • Enter the new URL where you want the original URL to redirect. This can be either the full URL (e.g., https://www.example.com/contact/) or the relative path (e.g., /contact/). 
  • Click the “Add redirect” button. The redirect manager will verify if the redirect is valid. 
  • Once created, the redirect will appear in the overview section below the redirect manager. 
  • There are other WordPress plugins that help you redirect multiple URLs to the same destination URL. 

Method 4 (Alternative): Use Redirection plugin  

Another effective way to create redirects in WordPress is by using the Redirection plugin. To begin, install and activate this redirect plugin from your WordPress dashboard.  

Note: While using a WordPress plugin to set up 301 redirects is straightforward, it may have a slight impact on performance. Depending on your hosting provider, redirects could be a few microseconds slower than other methods.  

  • Once the Redirection plugin is activated, go to Tools from left navigation panel of WordPress dashboard, then select on Redirection. Click the ‘Start Setup’ button. 
  • Next, you’ll see options to track permalink changes and keep a log of your redirects and 404 errors. You can simply enable these options and click the ‘Continue’ button. 
  • The plugin will automatically test the Rest API, and when the status shows as ‘Good,’ click the ‘Finish Setup’ button to proceed. 
  • Redirection will then complete its setup tasks and once the progress bar hits 100%, click ‘Continue,’ followed by the ‘Ready to Begin’ button. 
  • Now you’re set to start creating 301 redirects. Click on ‘Add New’ button on the top. Enter the URLs in the Source URL (the old page) and the Target URL field (where you want to redirect traffic). After filling in all the details, simply click the ‘Add Redirect’ button and your redirection is live. 

When to use 301 redirects in WordPress 

Setting up 301 redirects is essential for maintaining a seamless user experience and preserving your website’s SEO authority. Here are key scenarios where implementing 301 redirects is highly recommended: 

Canonicalization 

If you have multiple URLs with similar content, this can dilute your SEO potential. Use 301 redirects to consolidate these pages into a single, preferred URL, enhancing your website’s authority. Common uses include consolidating HTTP to HTTPS or non-www to www (and vice versa). 

Migrating from an old site to a new site 

When you migrate, the overall website structure and content locations may change, breaking links to resources. By implementing 301 redirects, you ensure that both users and search engines can continue accessing these valuable resources seamlessly. 

Reorganizing website content 

If you’re enhancing your site’s usability by reorganizing content, certain pieces may need to be moved permanently. A 301 redirect can keep your visitors connected to the content they need, no matter where it’s now located. 

Page or post deletion 

When you remove a high-traffic page or post, setting up a 301 redirect to a relevant alternative page is important. It helps prevent users from encountering 404 errors and preserves the SEO value of the deleted content. 

Redirecting expired to new content 

Let’s say you held a webinar and created a signup page for it. After the event ends, a 301 redirect can send users from the inactive signup page to a recorded session page. 

Website restructuring 

If you’re updating your site’s organization, such as creating new categories or modifying URL structures, 301 redirects help users and search engines stay connected to your content without interruption. 

Updating URLs 

When optimizing URLs for better readability or including keywords, it’s wise to set up 301 redirects from old URLs to new ones. This ensures users and search engines are directed to the latest, optimized URL, avoiding broken links and preserving link authority. 

Domain migration 

If you’re moving your website to a new domain, 301 redirects ensure that all existing traffic and SEO authority of the current domain flows seamlessly to the new one. 

Adjusting the permalink structure of your posts or pages can cause external links and bookmarks to break. By setting up 301 redirects from old URLs to the new URL structure, you maintain link integrity and provide users a smooth transition. 

Benefits of using 301 redirects in WordPress   

Here are some of the top ways that using 301 redirects in WordPress can be beneficial:   

Preserves the SEO value of your pages   

301 redirects pass the influence of an old webpage to a new one. If the old page ranked well on search engine results pages (SERPs), the 301 redirect preserves the search engine rankings of the new webpage.   

Provides a seamless user experience (UX)   

Broken links return a 404 (not found) error page, which can frustrate your visitors and disrupt the UX of your website. A 301 redirect on your WordPress site takes a split second to resolve and visitors probably won’t even notice when it happens.   

Minimizes duplicate pages   

While Google won’t penalize your website for having duplicate pages, it can experience difficulty determining which page to show in search results.   

Also, Google’s crawlers might fail to detect the similarity between duplicate pages, especially if the URLs have different parameters. Therefore, your pages may compete and rank for the same keywords.   

This dilutes the strength of your ranking signals, causing your content to rank lower. However, creating a 301 redirect on an old page to send traffic to a new page fixes this issue. 

Common redirect mistakes to avoid  

Confusing 301 and 302 redirects  

One common misstep when setting up website redirects is mixing up 301 and 302 redirect types. While both will send visitors to a new page, they signal different intentions to search engines, which can affect your SEO. Understanding the distinction is key.  

As a refresher, 301 is a permanent redirect, informing search engines that the original content has permanently moved for good. This means the new page inherits the link equity from the old page, which can help maintain your SEO rankings.  

In contrast, 302 is a temporary redirect. You might use this if you’re testing a new design and need to temporarily direct visitors elsewhere during development. A 302 tells search engines that the original content will eventually be back, so it should retain its PageRank and indexing.  

Failing to regularly track redirects  

It’s also essential to keep track of your redirects regularly. If you overlook this, your WordPress site could end up in an infinite redirect loop, which can hurt your bounce rate. Ideally, both search engines and visitors should be able to find the right content quickly and effortlessly.  

Redirecting to unrelated or outdated content  

Ensure that your redirections lead to relevant, updated content. When visitors click a link, they expect useful information, so redirecting them to related content will make for a smoother experience. This prevents users from bouncing to a competitor’s site and helps search engines understand your content. Plus, it boosts your rankings in search results. 

How to troubleshoot 301 redirects  

Troubleshooting 301 redirects can be straightforward when you know what to watch for. Here are some common issues to look out for:  

Check for redirect loops: Redirect loops happen when a URL continually redirects to itself or when two pages redirect to each other. This can frustrate visitors and cause search engines to stop crawling on the page. To avoid this, double-check that your redirects follow a linear path without looping back.  

Test URLs after redirection: Once you’ve set up a redirection, test the URL in your browser. This lets you see if it’s functioning as expected, sending users to the correct destination. Tools like Redirect Checker can also help you verify if the redirect path is clean and properly configured.  

Ensure consistency between old and new URLs: Sometimes redirects point users to content that doesn’t align with their expectations, especially if the new page isn’t related to the original content. When possible, link to pages that provide similar information to maintain a smooth user experience.  

Monitor redirect performance: You can set up Google Analytics or Search Console reports to see how redirects affect your site’s traffic. Pay attention to any drop in traffic that might indicate an issue with your redirects or their destination pages.  

Avoid redirect chains: A redirect chain occurs when one-page redirects to another, which then redirects to yet another page. This can slow down page load times, impacting both SEO and user experience. Aim to set up direct, single-step redirects whenever possible.  

If you’re consolidating your content or moving to a new domain, setting up 301 redirects is essential. Not only will this help you retain your current traffic, but it also ensures you don’t lose valuable search rankings. Plus, with redirects in place, you can prevent users from landing on broken links. 

Final thoughts: 4 ways to create a 301 redirect WordPress 

Based on your technical knowledge, you can choose which of the above redirection techniques you’re most comfortable with. Regardless of which method you choose, the redirects will work on any WordPress website and can even help with your website’s performance.  

To optimize your website further, Bluehost offers several WordPress web hosting plans. We’ll give you a free domain for your first year, offer automated WordPress updates and include a content delivery network (CDN) to boost your loading speed. Contact us today to learn more. 

FAQ: 301 redirect WordPress

Does Yoast support 301 redirects?  

Yes, Yoast includes a redirect manager that automatically creates 301 redirects when you delete or move pages.  

How do I fix a 301 error in WordPress?  

To resolve 301 errors, try these steps:  
Check the .htaccess file  
Review Redirection plugins  
Update the Permalinks structure  
Fix any broken links  
Implement 301 redirects  
Regularly monitor and test  

How do I set up 301 redirects?

You can set up 301 redirects in WordPress using a plugin, editing the .htaccess file or configuring server-side PHP redirects.

Do 301 redirects help SEO?  

Yes, 301 redirects are crucial for preserving SEO value when changing URLs, guiding both visitors and search engines from the old page to the new one.  

Do redirect chains harm SEO?  

Yes, redirect chains can hurt SEO by slowing down page loads and interrupting crawling. Google typically follows only up to five redirects per crawl, so chains can result in missed indexing. 

Why isn’t my website redirecting correctly? 

There can be several reasons why your 301 redirect isn’t functioning as it should. A frequent issue is caching, where the browser saves an older version of your website. Try clearing your browser cache along with any caching plugins in use. Additionally, review your .htaccess code carefully for any typos or syntax mistakes. 

What are some alternatives to 301 redirects? 

Although 301 redirects work well for permanent changes, there are situations where temporary redirects are more appropriate. In such cases, consider using 302, 303 or 307 redirects. These options can be helpful when testing new URLs or making short-term adjustments to your site. 

  • Jyoti Saxena

    Jyoti is a content writer at Bluehost. With 5 years of experience in the eCommerce industry, she strives to create content that resonates with sellers and resolves their pain points. Being a bookworm, she can be found reading books in her free time.

Learn more about Bluehost Editorial Guidelines

Write A Comment