Redirect to different subfolders according to geolocation without affecting SEO

Redirect to different subfolders according to geolocation without affecting SEO - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Redirect to different subfolders according to geolocation without affecting SEO error on your web browser. Problem :


I want to open different pages by default in different countries. But It affects SEO of main URL.



Like my website is example.com. I want to open this URL in India and example.com/abc outside India by default.



But my SEO of example.com should not be affected. how can I achieve that? I have written following script for this on top of index page.



<script>
$.ajax(
url: 'https://ipapi.co/json/',
dataType: 'json',
async: false,
success: function(data) {
if(data.country_name.toUpperCase() != "INDIA")
window.location.href = "/abc";
}
);
</script>


It is navigating fine, but it is deindexing example.com from google


Solution :

You can use rel=alternate to indicate that the example.com/abc is for outside India and that example.com is the default version. This way a user in India will find the example.com in his search results and any other user will see example.com/abc in his search results while in another country.



Checkout the google webmaster blog about rel=alternate.



I applied a different solution which is working fine now.



I created a script.js file for above redirection script and added it to my index page. Then I disallowed this script.js file for googlebot in robots.txt


We hope that this article has helped you resolve the seo, redirects, country-specific error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=