The science bit
When we ran the test we didn’t know if Google would pick up the redirect and even if it did, we didn’t know if it would pass any value to the redirected page. We therefore hypothesised that the client side redirect wouldn’t pass any value like a server side 301 redirect.
Choosing the blog post
To begin with we had to find two similar posts which ranked well for search queries which had a high number of impressions and clicks. Thanks to our founder Patrick Altorf (the blogging machine) we have a lot of blog posts to test!
We chose two pages which had similar content and intent:
Page A was an old one of Patrick’s which ranked well for a number of keywords around the .htaccess file. Page B was written by Mathew McCorry who is writes a lot of technical SEO articles for the B3 blog. Matt’s blog post ranks for a number of long tail keywords.
Once we had chosen the two blog posts we then wrote the JS redirect code (which you can see below) and added it to Page A, redirecting it to Page B.
Once we had made sure that the JS redirect was working, we prompted Google to come and recrawl the page on the 18th July using Fetch as Google.
Our team didn’t have to wait long because after a couple of days (20th of July) we began to see a drop in the number of organic sessions, impressions and clicks for page A.
While around the same time the number of organic sessions, clicks and impressions for page B increased and Matt’s blog post began to rank for keywords which page A used to rank for.
When now searching for “htaccess mod_rewrite” in Google, Matt’s post has replaced Patrick’s (it is now at position #1 when I search in incognito).
Furthermore, when doing an “info:” search operator for page A, Google is showing page B, indicating that Google has passed the value of page A to page B in its index.
What does this mean for SEO?
So does this mean we can start using client-side redirects instead of server-side redirects for our SEO activities?
I wouldn’t recommend it without testing.
A lot of tests have been run to see if JS is picked up by Google and all have shown that it can be irregular in what it picks up, even our own tests have shown this.
Something else you need to consider is that Google is the only search engine advanced enough to pick up the dynamic change (for the moment). I did a quick search in Bing and the page A still was still ranking as you can see from the image below.
For the time being I would stick to server-side redirects, which is what Google currently recommends, but if you’re really stuck and can’t get the redirects implemented then this might be a short term solution. But remember, test is best.