var redirect_host = "2site.com";
var current_location = window.location.toString();
var current_host = window.location.host.toString();
var redirect_location = current_location.replace(current_host, redirect_host);
window.location.href = redirect_location;
<script type='text/javascript'>
<?php
$arr = Array ( [0] => 1305 [1] => 1306 [2] => 1307 );
echo "var pr = " . json_encode($arr) . ";";
?>
</script>