1
I have a website meusite.net, but migrated to the realm meusite.com.br. However google has already indexed the more than 2000 pages I have on meusite.net. To solve this problem I created another page to use the domain meusite.net with the following redirect code:
<script>
location.href="https://www.meusite.com.br/";
</script>
But this code does not solve totally because redirects all indexed pages to meusite.com.br and I want for example on the link meusite.net/contact.html it automatically changes to meusite.com.br/contact.html. Keeping the rest of the url.
tried to get the url before?
var url = "https://www.meusite.com.br/" location.href= url + 'contato.html'
?– adventistaam
I had posted a response with a redirect code
var url = location.href.split("/"); location.href = "https://meusite.com.br/"+url.pop();
, but since I don’t know how Google will treat indexed pages with this redirect, I preferred to delete the answer.– Sam
I tested it. But this happens: the indexed page meusite.net/licenca/free.html redirects to meusite.com.br/free.html. Then it gives error 404 because it is not the complete link.
– Weslley Hordman