Are Javascript Redirects SEO Friendly?

Posted by

So, you wish to implement JavaScript redirects, however you’re not sure how they work?

Yes, they are more challenging to execute than standard redirects.

Ideally, you need to utilize 301s, 302s, or 307-based redirects for implementation. This is the usual finest practice.

But … what if you don’t have that level of access? What if you have an issue with developing basic redirects in such a way that would be useful to the site as a whole?

This is where utilizing JavaScript redirects can be found in.

They are not a finest practice that you should be utilizing specifically, nevertheless.

But there are some situations where you just can not avoid utilizing a JavaScript redirect.

The following is a fundamental primer on JavaScript redirects, when to use them, how to utilize them, and best practices you need to use when making use of these kinds of redirects for SEO.

What Are JavaScript Redirects?

JavaScript reroutes, basically, are among a number of techniques of informing users and web spiders that a page is readily available in another place.

They are typically used to notify users about modifications in the URL structure, but they can be used for just about anything.

Most contemporary sites utilize these kinds of redirects to redirect to HTTPS versions of websites.

Then, whenever someone goes to the original URL, the internet browser loads the JavaScript file and performs whatever code is inside of it. If the script consists of guidelines to open a various URL, it does this instantly.

Doing redirects in this way is useful in a number of ways.

For instance, you can switch URLs without by hand updating every URL on your website. In addition, JavaScript redirects can make it simpler for search engines to discover your own material.

A Quick Introduction Of Redirect Types

There are several standard redirect types, all of which are useful depending upon your situation.

Server-side Redirects

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

These types of redirects originate 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 factors, you will likely use server-side reroutes the majority of the time. Client-side redirects have some drawbacks, and they are usually ideal for more particular scenarios.

Client-side Redirects

Client-side redirects are those where the web browser is what decides the place of where to send out the user to. You should not have to utilize these unless you remain in a scenario where you don’t have any other alternative to do so.

Meta Refresh Redirects

The meta revitalize reroute gets a bad rap and has an awful track record within the SEO neighborhood.

And for great reason: they are not supported by all browsers, and they can be confusing for the user. Rather, Google advises using a server-side 301 redirect instead of any meta refresh redirects.

JavaScript Redirects

JavaScript redirects, nevertheless, use the JavaScript language to send out directions to the browser to reroute users to another URL. There is a prevailing belief that JavaScript reroutes cause problems for SEO.

Although Google does have excellent JavaScript rendering abilities these days, JavaScript can still present problems. This is true for other kinds of platforms likewise, such as Spotify and other ecommerce platforms.

If, however, you remain in a circumstance where you can just utilize a JavaScript reroute as your only option, then you can just use JavaScript.

Also, Google’s Gary Illyes has actually mentioned as recently as 2020 that JavaScript Redirects “are probably not an excellent idea.”

Js redirects are probably not a great idea though.

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

Best Practices For SEO-Friendly JavaScript Redirects

Despite whether you are utilizing conventional redirects or JavaScript redirects, there are a number of best practices you must follow in order to not mess things up for SEO.

These finest practices include preventing redirect chains and reroute loops.

What’s the difference?

Prevent Redirect Chains

A redirect chain is a long chain of redirect hops, referring to any scenario 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 only process as much as three redirects, although they have been known to process more.

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

“It doesn’t matter. The only thing I ‘d look out for is that you have less than 5 hops for URLs that are often 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: as much as 5 hops in the chain per crawl attempt).”

Preferably, 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 introduce considerable confusion when it comes to Googlebot having the ability to understand your site at all.

Fixing redirect chains can take a lot of work, depending upon their complexity and how you set them up.

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

First, remove the extra hops in the redirect so that it’s under five hops.

Second, execute a redirect that redirects the previous URLs

Prevent Redirect Loops

Redirect loops, by contrast, are essentially a boundless loop of redirects. These loops occur when you reroute a URL to itself. Or, you unintentionally redirect a URL within a redirect chain to a URL that occurs 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 want a circumstance where you carry out a redirect only to discover 3 months down the line that the redirect you created months back was the reason for problems due to the fact that it created a redirect loop.

There are numerous reasons why these loops are dreadful:

Relating to users, redirect loops remove all access to a particular resource situated on a URL and will wind up causing the web browser to display a “this page has too many redirects” mistake.

For search engines, redirect loops can be a significant waste of your crawl budget. They likewise create confusion for bots.

This produces what’s referred to as a spider trap, and the spider can not get out of the trap easily unless it’s by hand pointed somewhere else.

Fixing redirect loops is quite easy: All you need to do is get rid of the redirect causing the chain’s loop and replace it with a 200 OK operating URL.

Want To Use JavaScript Redirects For SEO? Not So Fast …

Be cautious about creating JavaScript reroutes since they might not be the best option for redirects, depending on what you have access to.

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

But, if they are the only alternative, you may not be shooting yourself in the foot.

More resources:

Included Image: RoseRodionova/Best SMM Panel