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, we had to find two similar posts that ranked well for search queries and had a high number of impressions and clicks. Thanks to our founder Patrick Altoft (the blogging machine), we had a lot of blog posts to choose between!
We chose two pages that had similar content and intent:
Page A: https://www.branded3.com/blog/htaccess-mod_rewrite-ultimate-guide/
Page B: https://www.branded3.com/blog/setting-up-permanent-301-redirects-in-htaccess/
Page A was an old post by Patrick which ranked well for a number of keywords around the .htaccess file.
Page B was written by Mathew McCorry, who has written a number of technical SEO articles for the Branded3 blog. Mat’s blog post ranks for a number of long tail keywords.
Once we had chosen the two blog posts, we 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 re-crawl 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 July) we began to see a drop in the number of organic sessions, impressions and clicks for page A.
Around the same time the number of organic sessions, clicks and impressions for page B increased and Mat’s blog post began to rank for keywords which page A used to rank for.
When now searching for “htaccess mod_rewrite” in Google, Mat’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 that 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.