Are Javascript Redirects SEO Friendly?

Posted by

So, you want to implement JavaScript redirects, but you’re uncertain how they work?

Yes, they are more challenging to carry out than standard redirects.

Preferably, you ought to use 301s, 302s, or 307-based redirects for implementation. This is the usual best practice.

However … what if you don’t have that level of access? What if you have an issue with producing standard redirects in such a method that would be useful to the website as a whole?

This is where using JavaScript reroutes can be found in.

They are not a finest practice that you ought to be using specifically, nevertheless.

However there are some scenarios where you just can not avoid using a JavaScript redirect.

The following is a fundamental guide on JavaScript reroutes, when to use them, how to use them, and best practices you should use when utilizing these types of redirects for SEO.

What Are JavaScript Redirects?

JavaScript reroutes, basically, are one of several techniques of informing users and web crawlers that a page is offered in another area.

They are often utilized to inform users about changes in the URL structure, however they can be utilized for practically anything.

Many modern-day sites utilize these kinds of redirects to reroute to HTTPS versions of websites.

Then, whenever somebody goes to the initial URL, the internet browser loads the JavaScript file and executes whatever code is within it. If the script consists of guidelines to open a various URL, it does this automatically.

Doing redirects in this manner is useful in several ways.

For example, you can change URLs without by hand updating every URL on your website. In addition, JavaScript redirects can make it simpler for online search engine to discover your own content.

A Quick Introduction Of Redirect Types

There are several basic redirect types, all of which are advantageous depending upon your scenario.

Server-side Redirects

Preferably, a lot of redirects will be server-side redirects.

These types of redirects stem on the server, and this is where the server chooses which location to reroute the user or online search engine to when a page loads. And the server does this by returning a 3xx HTTP status code.

For SEO reasons, you will likely use server-side redirects most of the time. Client-side redirects have some disadvantages, and they are usually suitable for more specific scenarios.

Client-side Redirects

Client-side redirects are those where the web browser is what decides the area of where to send out the user to. You should not have to utilize these unless you remain in a situation where you do not have any other choice to do so.

Meta Refresh Redirects

The meta revitalize redirect gets a bum rap and has a terrible reputation within the SEO community.

And for excellent reason: they are not supported by all browsers, and they can be puzzling for the user. Instead, Google suggests using a server-side 301 redirect rather of any meta refresh reroutes.

JavaScript Redirects

JavaScript redirects, however, utilize the JavaScript language to send instructions to the internet browser to redirect users to another URL. There is a prevailing belief that JavaScript reroutes cause issues for SEO.

Although Google does have great JavaScript rendering capabilities these days, JavaScript can still present concerns. This holds true for other kinds of platforms likewise, such as Spotify and other ecommerce platforms.

If, however, you remain in a scenario where you can just utilize a JavaScript redirect as your only choice, then you can just utilize JavaScript.

Likewise, Google’s Gary Illyes has specified as just recently as 2020 that JavaScript Reroutes “are most likely not a good idea.”

Js redirects are most likely not a good idea though.

— Gary 鯨理 / 경리 Illyes (@methode) July 8, 2020

Best Practices For SEO-Friendly JavaScript Redirects

Despite whether you are using conventional redirects or JavaScript reroutes, there are several finest practices you should follow in order to not mess things up for SEO.

These best practices include preventing redirect chains and reroute loops.

What’s the distinction?

Avoid Redirect Chains

A redirect chain is a long chain of redirect hops, describing any circumstance where you have more than 1 redirect in a chain.

Example of a redirect chain:

Reroute 1 > redirect 2 > redirect 3 > redirect 4 > redirect 5

Why are these bad? Google can just process as much as three redirects, although they have been understood to process more.

Google’s John Mueller suggests less than 5 hops per redirect.

“It does not matter. The only thing I ‘d keep an eye out for is that you have less than 5 hops for URLs that are frequently crawled. With several hops, the main result is that it’s a bit slower for users. Online search engine simply follow the redirect chain (for Google: approximately 5 hops in the chain per crawl attempt).”

Ideally, webmasters will want to aim for no greater than one hop.

What takes place when you include another hop? It decreases the user experience. And more than five present considerable confusion when it comes to Googlebot being able to comprehend your website at all.

Repairing redirect chains can take a great deal of work, depending upon their intricacy and how you set them up.

But, the main principle driving the repair work of redirect chains is: Just ensure that you total 2 actions.

First, get rid of the extra hops in the redirect so that it’s under 5 hops.

Second, execute a redirect that redirects the former URLs

Avoid Redirect Loops

Redirect loops, by contrast, are essentially an infinite loop of redirects. These loops occur when you redirect a URL to itself. Or, you unintentionally reroute a URL within a redirect chain to a URL that happens previously in the chain.

Example of a redirect loop: Redirect 1 > redirect 2 > redirect 3 > redirect 2

This is why oversight of website redirects and URLs are so crucial: You do not desire a circumstance where you execute a redirect just to discover 3 months down the line that the redirect you created months earlier was the cause of issues since it created a redirect loop.

There are a number of reasons why these loops are disastrous:

Relating to users, reroute loops eliminate all access to a particular resource located on a URL and will wind up causing the web browser to display a “this page has a lot of redirects” error.

For online search engine, redirect loops can be a considerable waste of your crawl budget. They also produce confusion for bots.

This develops what’s described as a spider trap, and the spider can not leave the trap easily unless it’s manually pointed somewhere else.

Repairing redirect loops is pretty easy: All you have to do is eliminate the redirect causing the chain’s loop and change it with a 200 okay operating URL.

Wish To Utilize JavaScript Redirects For SEO? Not So Quick …

Beware about producing JavaScript redirects because they might not be the very best solution for redirects, depending on what you have access to.

They must not be your go-to solution when you have access to other redirects since these other kinds of redirects are chosen.

However, if they are the only option, you may not be shooting yourself in the foot.

More resources:

Featured Image: RoseRodionova/Best SMM Panel