AI Tools | ChatGPT Alternative for banned countries

Redirect from old to new domain with same uri




Recently i have changed my blog url to a new domain and i had to find a way to redirect old traffic calls to the new domain after noticing a big drop on site traffic and here is how you can do it

it works for any kind of website just make sure you put this code after adding your domain in it to the header of your main template, in case if you have a blogger then you have to put it in the layout section by creating a new widget for code

the Code:

<script type="text/javascript">
	// Get Current URL
	var url = window.location.href;
	// Replace domain in URL
	var newurl = url.replace("olddomain.com", "newdomain.com");
	// Redirect to new URL
	document.location = newurl;
</script>

Comments