Redirects 101: A Beginner’s Guide to Setup & Best Practices
Automatically redirecting users and search engines from one URL to another is the purpose of redirects.
For example, if you attempt to visit
https://backlinko.com/hub/youtube/position (which includes a redirect), you’ll be sent to https://backlinko.com/hub/youtube/positioning instead.
HTTP Status – URL status check
Redirects ensure that outdated URLs lead users and search engines to current, relevant content.
This improves user satisfaction, maintains valuable backlinks, and helps search engines crawl and index your site more efficiently.
The bottom line: Redirects can assist in managing website structure while enhancing SEO performance.
However, this only happens when they’re implemented correctly.
In this guide, you will learn:
- What redirects are
- The correct way to implement redirects
- Best practices for utilizing redirects
When to Use Redirects
As websites grow and change, there will likely come a time when adding a redirect becomes essential.
Let’s examine some situations where redirects may be necessary.
When to use redirects
Moving a Website (Site Migration)
Redirects are often required during site migrations, particularly in these scenarios:
Changing Domain Names
When switching from www.oldsite.com to www.newsite.com , every page on the old domain should point to its corresponding page on the new site.
This ensures that anyone trying to access an old page still lands on the relevant version of the updated website. For more details on this process, consult our website migration checklist.
Content Management System (CMS) Changes
Different content management systems may organize URLs differently. For instance, moving from WooCommerce (WordPress) to Shopify could result in changes to some of your web addresses.
Shopify uses /collections for categories. As a result, yoursite.com/category/mens-clothing would become yoursite.com/collections/mens-clothing on Shopify.
Without implementing redirects, users and search engines might face challenges finding your updated pages.
International Expansion
Another scenario involving redirects is transitioning to a different (country code) top-level domain, such as moving from yoursite.com to yoursite.co.uk.
This is common when website owners expand into new regions and aim to create dedicated websites for specific markets.
Deleting Pages
When removing a page from your site, redirects can guide users to a related or similar page.
For instance, if you have two pages on the same topic and merge them into a more comprehensive guide, it’s essential to set up redirects from both original pages to the new one.
Merging two URLs
Otherwise, users attempting to access the old (deleted) versions will encounter a 404 error.
Switching to HTTPS
Hypertext Transfer Protocol Secure (HTTPS) ensures encryption between servers. Therefore, redirecting HTTP webpages to their HTTPS counterparts is crucial for enhanced security.
This is because browsers treat HTTP and HTTPS URLs as distinct, even for the same page.
For example, typing http://backlinko.com into your browser automatically redirects you to https://backlinko.com. This guarantees that you’re always accessing the secure version of the site.
Changing URLs (Permalinks)
If you modify your site’s URL structure (or permalinks), setting up redirects from the old URLs to the new pages is necessary.
For example, if your previous URL was www.yourwebsite.com/category/page?id=123 and you change it to www.yourwebsite.com/new-page , you’ll need to add a redirect from the old URL to direct visitors automatically to the updated one.
How Redirects Impact SEO
Incorrectly implemented redirects can harm your SEO by causing broken links, loss of page authority, and reduced rankings.
However, when used properly, redirects offer several SEO advantages:
1. Preserve Link Equity
Link equity, also known as “link juice,” refers to the value a webpage gains from backlinks. When redirects are configured correctly, most of the link equity from the old URL should transfer to the new one.
2. Help Search Engines Understand Site Structure
Redirects assist search engine bots in locating the correct pages. They clarify your site’s structure, making it easier for crawlers to index and rank your latest content.
This prevents search engines from wasting time crawling outdated or non-existent pages, optimizing your site’s crawl budget.
Improve User Experience Redirects ensure visitors find the right pages on your site. This avoids dead ends or outdated content when users click your links, enhancing their overall experience.
A positive user experience encourages visitors to stay longer and potentially return to your site in the future. This benefits your SEO since Google rewards content that delivers a good page experience, which may result in higher rankings.
However, redirects can influence your page speed, possibly creating noticeable delays for users (though this isn’t always the case). This could lead to a subpar user experience.
Thus, it’s wise to check your site speed after implementing redirects to ensure smooth performance. Tools like PageSpeed Insights can help with this evaluation.
Types of Redirects
There are two primary categories of redirects:
- Server-side
- Client-side
Let’s examine each type in detail so you can determine which ones to use.
1. Server-Side Redirects
Server-side redirects are configured on the server hosting your website.
There are several types of server-side redirects, with the most common being:
- 301 Permanent Redirects
- 302 Temporary Redirects
- 303 Temporary Redirects
- 307 Temporary Redirects
- 308 Permanent Redirects
The two most frequently used for SEO purposes are 301 and 302 redirects .
301 Permanent Redirects
Use 301 redirects for pages that have been permanently moved.
For instance, Backlinko previously had a backlinks guide page at https://backlinko.com/backlinks-guide.
Backlinko – Backlinks Guide – Archive
This page was later updated and integrated into a broader hub on the topic.
Backlinko – Hub – SEO – Backlinks
With this change, the URL was updated to https://backlinko.com/hub/seo/backlinks .
By using a 301 permanent redirect , Google recognizes that this is the URL we want indexed.
Google SERP – What are backlinks
Using 301 redirects ensures that the ranking power from the old URL is transferred to the new one.
Note: There’s no guarantee that all ranking ability from the old page will transfer to the new one when using redirects.
302 Temporary Redirects
Use 302 redirects for pages temporarily relocated to a new URL, such as during sales campaigns or temporary site maintenance.
With a 302 redirect , users are sent to the new page, but search engines (generally) don’t update their index to the new URL—at least not immediately.
The original URL typically retains its ranking power.
However, Google’s indexing pipeline treats 302 redirects as a “weak” signal that the target URL is canonical (i.e., the one you want Google to index). As with any redirect, use 302 redirects carefully.
307, 308, and 303 Redirects
These types of redirects are less commonly used for SEO purposes.
Google considers 307 equivalent to 302 and 308 equivalent to 301 . You might use 303 redirects to prevent resubmission of form data when a user clicks refresh or the back button.
Google Search Central – Redirects – URL indexing
2. Client-Side Redirects
A client-side redirect is added to your webpage rather than your server. These are easier to set up than server-side redirects and are useful for tasks like website maintenance, A/B testing, or seasonal promotions.
However, they come with some drawbacks:
- Slower loading times, which can frustrate users
- Reduced reliability because some users disable JavaScript in their browsers (which some client-side redirects rely on)
- Higher security risks as hackers can more easily manipulate them
Note: Due to these issues, client-side redirects are rarely the best choice. Server-side redirects, particularly 301 and 302 redirects , are usually better options.
The two common types of client-side redirects are:
Meta-Refresh Redirects
A meta-refresh redirect is an HTML element that instructs the browser to refresh the page after a specified number of seconds and then redirects to a different URL.
These are often used for simple redirects but can cause slight delays and lead to a poor user experience.
You place meta-refresh redirects in the <head> section of your page, and they look like this:
html
1
<meta http-equiv=”refresh” content=”3; url=https://www.yourwebsite.com/new-page “>
In this example, the redirect would trigger after three seconds.
JavaScript Redirects
A JavaScript redirect adds a script within your HTML. If the search engine doesn’t render JavaScript, it won’t detect the redirect.
If you need to use JS redirects, place the JavaScript code within <script> tags, typically in the <head> or <body> sections of your HTML. It might look something like this:
html
1
2
3
⌄
<script type=”text/javascript”>
window.location.href = “https://www.yourwebsite.com/new-page “;
</script>
How to Implement Redirects
Implementing effective redirects can range from simple page updates to complex site-wide changes, each requiring a different strategy and level of effort.
For example, if you’re updating or consolidating a few pages, the process is generally straightforward. You’ll only need redirects for those specific URLs, and you might complete this in minutes.
But if you’re making site-wide changes—such as changing your domain or restructuring your website entirely—you’ll need a comprehensive redirect plan.
Regardless of the scale of your planned redirects, stay organized by listing all your redirects in a spreadsheet, like the one below.
Redirects – Monitoring table
This provides a clear, comprehensive record, making it easier to implement the correct redirects and make any necessary adjustments later without causing further issues.
Once you’ve compiled a list of your planned redirects, it’s time to implement them. We’ll show you how to do this using two methods:
- Using a WordPress plugin
- Editing your .htaccess file
If you’re not using WordPress or don’t have access to your .htaccess file, consult your platform’s documentation or search for “[Your CMS name] + redirects” for guidance.
Setting Up SEO Redirects on WordPress
One of the easiest ways to manage redirects in WordPress is by using a plugin like the 301 Redirects Plugin .
This simplifies the process, especially if you’re uncomfortable editing server files directly.
Once installed and activated, navigate to “Settings” > “301 Redirects” in your dashboard.
WordPress – Plugins – 301 Redirects
Set up your redirects here, with options to use a 301 , 302 , or 307 redirect . Simply select the type of redirect you want, the URL you want to redirect, and the target (new) URL.
Then click “Save.”
301 Redirects – Backlinko.com
There are various other plugins that offer redirect capabilities. However, if you’re comfortable editing your site’s files directly, you can use your .htaccess file instead.
Setting Up Redirects on .htaccess
The .htaccess file is a special file used by websites running on Apache servers. It gives you control over important website settings.
Accessing and Editing the .htaccess File
You can access the .htaccess file using your hosting provider’s file manager tool.
Here’s how:
First, log into your hosting account and locate a folder labeled “File Manager” or something similar.
cPanel – File Manager
This will take you to all the files hosted on your server.
cPanel – File Manager – Files
Next, locate or create the .htaccess file. It’s typically found in the root directory where your website’s files are stored, often named “public_html” or “www.”
Look for a file named “.htaccess” (note the leading period).
File Manager – .htaccess file
If it’s not there, create a new file with this exact name.
File Manager – Create .htaccess file
Note: Before making changes, back up the .htaccess file by downloading it and saving it to your computer. This ensures you can easily revert to the previous version if something goes wrong.
Open your .htaccess file in a text editor like Notepad++ or Sublime Text.
Before adding a redirect, enable the RewriteEngine module, which allows URL rewriting rules.
To do this, add the following code at the top of your .htaccess file:
apache
1
2
3
RewriteEngine On
If RewriteEngine On is already present, skip this step and proceed to the next ones.
Then, add the redirect rules below RewriteEngine On and before .
The specific code you add will depend on the type of redirect you need. You may also need to adjust parts of the rules to suit your situation, such as applying them to all traffic or specific subdomains.
Redirect One Page
When redirecting a single page, use the following code:
apache
1
Redirect 301 /old-page https://www.yourdomain.com/new-page
Redirect an Entire Directory Within Your Current Domain
To redirect an entire directory, add this code:
apache
1
RewriteRule ^old-directory/(.*) /new-directory/$1 [R=301,L]
This ensures each page in the old directory corresponds to the relevant pages in the new directory.
Redirect to Another Domain
For redirecting traffic from your current domain to a new one, use:
apache
1
2
RewriteCond %{HTTP_HOST} ^olddomain.com$ [NC]
RewriteRule ^(.*)$ https://newdomain.com/ $1 [L,R=301]
This rule redirects each individual page on the old domain to the corresponding page on the new domain.
Redirect HTTP to HTTPS
Add the following code for HTTP to HTTPS redirects:
apache
1
2
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Many web hosts automatically handle HTTP to HTTPS redirects, eliminating the need to edit your .htaccess file.
If editing your .htaccess file manually feels overwhelming, use Aleyda Solis’ .htaccess Redirects Generator to simplify the process and reduce errors.
Aleyda Solis Htaccess Redirects Generator – Homepage
Best Practices for SEO-Friendly Redirects
1. Redirect to Relevant and Similar Pages
Send users to the most relevant and similar content available by following these guidelines:
- If the content from an old page exists elsewhere, redirect directly to that page.
- For duplicate pages, redirect to the main, authoritative version.
- If a page is outdated or being replaced, redirect to a new page with updated information.
- If the content is completely irrelevant or there’s no suitable replacement, delete the page and serve a 404 error message.
Expert tip: If you plan to delete a page with many high-quality backlinks, consider creating a new, relevant page instead. This preserves the old page’s link equity and avoids resorting to a 404 error.
2. Avoid Redirect Chains and Loops
Redirect chains occur when one URL redirects to another, which then redirects again, forming a chain.
Redirect chain
Redirect loops happen when one page redirects to another, which then redirects back to the original page, creating an endless loop.
Redirect loop
Both issues confuse search engines, leading to crawling inefficiencies and potential loss of page authority.
While Googlebot can follow up to 10 redirect hops, it’s best to link directly to the new page whenever possible. Fewer hops make the process faster for users and search engines while minimizing broken links if one redirect fails.
3. Don’t Link to Pages with Redirects
Avoid linking to redirected pages, as this creates unnecessary redirects, slows down your site, and confuses users and search engines.
Instead, update your internal links to point directly to the final destination page.
4. Avoid Soft 404s
Soft 404s occur when you redirect to a page unrelated to the original page.
GSC – Soft 404 indexing error
For example, redirecting a product page that no longer exists to your homepage confuses users and search engines.
If there’s no relevant page to redirect to, either leave it as a 404 or create a new, relevant page that meets user intent.
5. Keep Redirects for at Least One Year
Google recommends keeping redirects for at least one year after migrating your website (though this applies to all redirects). This gives users and search engines time to adapt to the changes.
Leaving redirects for this long allows Google to crawl the site and transfer authority from the old page to the new one. It also gives other websites time to update their links.
However, as Gary Illyes of Google suggests, keeping them indefinitely is ideal if possible.
X – Gary Illyes – Post
6. Test and Monitor
Regularly monitor your redirects to ensure they’re functioning properly and not causing issues.
Here are three ways to do this:
- Manual Testing : If you’ve only redirected a few pages, manually enter the old URLs in your browser and verify they redirect to the new ones. Alternatively, use tools like Redirect Path (for Chrome) or the HTTP Status Code Checker tool.
- Automated Tools : For larger-scale redirects, use SEO tools like Screaming Frog SEO Spider or Semrush Site Audit. These tools crawl your site, identify redirects, and report errors. For example, in Semrush Site Audit, you can search for redirect-related issues and receive guidance on fixing them.
Semrush – Site Audit – Redirect
Try it yourself with a 14-day free trial of Semrush Pro via this link.
Monitor Redirects with a Spreadsheet : The Redirectinator, a free spreadsheet created by Jeff Louella of The Tech SEO, automatically monitors your redirects to ensure they’re implemented correctly.
The Tech SEO – Homepage
7. Update Internal Links and Sitemaps
Redirects are suggestions, not directives, meaning search engines decide whether to treat the redirected URL as canonical based on all available signals.
To increase the chances of search engines treating your redirected URLs as canonical:
- Update all internal links to point to the new URLs.
- Update your sitemap to reflect the new structure.
Partner with our Digital Marketing Agency
Ask Engage Coders to create a comprehensive and inclusive digital marketing plan that takes your business to new heights.
These steps help avoid sending mixed signals to Google by maintaining consistency, making it easier for search engines to understand and follow your redirects.
Watch John Mueller discuss redirects as signals for canonicalization below:
Set Up Effective Redirects and Boost Your Rankings
Effective redirect management isn’t optional—it’s essential for:
- Preserving link equity
- Enhancing user experience
- Optimizing your site for search engines
For an easy way to find pages on your site that might need redirects, check out our guide to finding (and fixing) broken links.