Redirects

As a website owner, you will encounter redirects at one point or the other. It helps your users and search engines when you want to move a page, delete a page, or merge multiple websites. 

However, redirects may seem difficult to understand, especially when different redirects apply to each scenario. Hence, you need to understand the differences. 

In this article, you will learn about redirects, including its meaning, types, and how to implement them. 

What is a redirect?

A URL redirect is a line of code that sends users and search engines to a URL other than the one they originally intended to visit. 

The new URL should contain similar information to the initial page or serve a similar purpose. 

Website owners often set up redirects for pages that are broken, are down, or contain duplicate content.

With this, users and search engines can access the most relevant content on a page. 

For instance, if you sell perfumes, and a user wants to visit your page to learn about perfumes for males.

If they go to the designated page, and they discover that it is currently down for some reason, you need to send your users to a different page. 

To do that, you need to create a redirect on that page. That means that whenever a user visits the initial URL, they get redirected to the new page you have created. 

Why should you redirect a URL?

Redirects are useful for different situations. Here are some common instances that can prompt you to use redirects on your site:

Merging websites

If you are merging websites into one, you will need to permanently redirect the old URLs to the new ones. 

When switching to HTTPS

If you are switching from HTTP to HTTPS, you will need to redirect the unsecured (HTTP) pages and resources to the secured location (HTTPS).

When moving domains

If you are rebranding and moving from one domain to another, you will have to permanently redirect all the pages from the old domain to the new domain.

When deleting pages

If you are removing content from your site, you’ll need to permanently redirect the URL to another page that has similar or relevant content. 

What are the types of redirects?

Redirects are categorized into different types. Some of these include:

  • 301 redirects
  • 302 redirects
  • 307 redirects
  • 401 redirects
  • 404 redirects
  • Meta refresh redirects

301 redirect: permanent redirect

A 301 redirect sends users to the new URL and, subsequently, tells the search engine that it’s a permanent redirect. 

As a result, the search engine drops the old URL from its index and favors the new URL. They also transfer the authority from the old URL to the new one. 

302 redirect: temporary redirect

A 302 redirect sends users to a new URL and tells the search engine that it’s a temporary redirect. 

Although the move is temporary, 302s can still transfer the page authority of the old page to the new one.

If the temporary redirects are kept in place for a long time, the search engine misunderstands the redirect rules and treats the 302 like a 301 redirect, and indexes the temporary URL.

307 redirect: temporary redirect  

A 307 redirect indicates that the resource is moved temporarily to a new URL given by the location headers. It is similar to a 302 redirect. 

The difference is that the 302 requests are given resources through the GET method only. Meanwhile, the 307 requests are given resources through the GET or POST method.

401 redirect

A 401 redirect is a type of HTTP status code that tells users that the requested resource requires valid authentication credentials before they can gain access. 

Users may need a username and password to access the resource. 

A 401 redirect can be harmful to a website’s search ranking when the content is not publicly accessible and may not be valuable to the user.  

404 redirect: error message

A 404 redirect is a server response code that tells users that a webpage cannot be found. This is due to a user error when inputting the URL, or the actual web page error doesn’t exist.

Meta refresh redirects

Meta refreshes are a type of page-level redirects, not server-level redirects.

They tend to be slower and are not a recommended SEO method.

They are commonly associated with a five-second countdown with the text “If you’re not being redirected in five seconds, click here.”

Meta refreshes convey some link equity but are not recommended as an SEO tactic because of poor usability and loss of conveyed link equity.

A meta-reference update might look like this:

<http-equiv="refresh" content="0; url=https://yoursite.com/">.

How to implement redirect rules

Implementing a redirect depends on the tool you intend to use. 

How to implement URL redirects on WordPress in .htaccess?

A popular way to implementing redirects is through the .htaccess file, which operates on the Apache web servers.

Below is a list of common .htaccess directives for redirects.

1. To redirect an entire domain to a new DOMAIN:

Redirect 301 / http://www.yoursite.com/

Substitute the domain with your new redirect target URL. This directive will redirect all pages of your site to the corresponding URL of the target domain.

2. To redirect a single page

Redirect 301 /oldpage/ http://www.yoursite.com/newpage/

This redirection can be used on different domains or on your own site.

3. Use Apache mod_rewrite

In your .htaccess file, you can also use Apache mod_rewrite for a more fluid redirection. 

To give an example, here is the code you’d need to redirect a non-www subdomain to a www subdomain.

RewriteEngine on

RewriteBase

rewritecond %{http_host} ^domain.com [nc]

rewrite rule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

How to implement URL redirects on Hubspot?

Here is a guide that shows you how to implement redirects on Hubspot.

  • In your Hubspot account, you can click on the “Settings” icon.
  •  Then, navigate to Website > Domain URLs. 
  • Click the URLs Redirect tab.
  • Click on Add URL redirect.
  • Then, select the Standard or Flexible redirect. A standard redirect redirects one URL to another. Meanwhile, the flexible URL updates the URL based on its structure.
  • In the Original field, input the full original URL you want to redirect.
  • In the Redirect field, input the full URL of the page you want the original URL to redirect to.
  • Finally, click on Add URL redirect.

JavaScript redirects

Although you can technically implement redirects using JavaScript, this SEO technique is not recommended.

Although testing has revealed that Google can interpret a JavaScript redirect as a 301 (permanent redirect), this is not self-evident.

Since JavaScript redirects are executed on the client side and not on the web server side, there is no assurance that Google will correctly index the redirects.

Lastly, there’s no way to have an HTTP status code declared when using JavaScript for redirects.

Below is an example of how you can implement a JavaScript redirect:

<script type="text/javascript"> 
function redirect1()
{ window.location = "http://www.yoursite.com/new-url/" } 
setTimeout('redirect1()', 5000); 
</script>.

How to troubleshoot and fix a redirect loop in WordPress?

A redirect loop can frustrate your users and hinder conversions on your site. To avoid this, here are some tips for you.

1 – Check your URL settings

When your WordPress address and site address differ from the permalinks you have with your hosting provider, it could cause a redirect loop.

You can fix this by editing your WordPress address and your site address in the “general settings” section to match how you configure your site with your hosting provider.

2 – Clear your browser’s cookies

When your browser stores cookies from two sites that share the same IP address, it can cause a redirect loop error.

You can avert this by adding code to your site’s wp-config.php file so that it clears the cookies anytime you visit your site.

3 – Upgrade to a dedicated IP address

When you use web hosting, you could end up sharing an IP address with multiple sites.

This can prevent your browser from not knowing where to visit and cause a redirect loop. But you can avoid this by upgrading to a dedicated IP address on your site. 

3 – Disable Plugins

If you activate a new plugin or update the existing one, it can cause a redirect loop.

However, you can avoid this by disabling all your plugins. If you can’t narrow down the list, you can disable all your plugins to figure out the culprit.

Three redirect checker tools

There are several tools you can use to check redirects. Here are three tools you can use to check redirects.

1 – Redirect tracker

Redirect tracker is a free service by Website Planet that helps to analyze individual URLs. The tool is simple to use.

All you need to do is to copy and paste the name of the URL to their search query and click on “click.” 

2 – HTTPStatus

If you need to check hundreds of links at once, HTTPStatus is your best shot. It is a free tool that allows you to check many links for status codes, chains, loops, and response headers. 

It comes in handy for SEO professionals and allows them to analyze and optimize the tools. It also offers insight into how search engines perceive the pages due to their features.

3 – HEADMasterSEO

HEADMasterSEO is another effective tool you can use to check up on hundreds of links at once. It allows you to check for redirects, status codes, HTTP heads, and response time. 

It presents all data in a visual format that is appealing and understandable to all.

HEADMasterSEO is one of the best tools to check out if you want to check redirects in bulk.

Key takeaways

  • A redirect is a line of code that sends users and search engines to a URL other than the one they originally intended to visit.
  • You can redirect URLs when you want to merge websites, switch domains, delete pages, or switch to HTTPS.
  • Redirects can be categorized into different types, which include 301 redirects, 302 redirects, 307 redirects, 401 redirects, 404 redirects, and meta refresh.

Get 3 – 5 meetings every week

We can fill your calendar with 3- 5 meetings every week. Just tell us who is your ideal customer, and we’ll get you meetings with them.