Since I couldn't find the answer to this question anywhere, so here comes the question. But before that, Thanks to anyone who answers/helps in anyway.
The pseudo-code of the index.php page is:
<html>
<head><script>
<?php
$links = parse_ini_file('links.ini');
if(isset($_GET['l']) && array_key_exists($_GET['l'], $links)){
$my_phpvar = $links[$_GET['l']];
}
else{
header('HTTP/1.0 404 Not Found');
echo 'Unknown link.';
}
?>
var myjsvar= <?php echo $my_phpvar; ?>
function go(){
document.cookie = "visited=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
window.location.href = "myjsvar";
}
</script></head>
<body><a id="myA1" href="javascript:go();" target="_blank">Click</a></body>
</html>
As is evident, in the above code the myjsvar comes from my_phpvar, and my_phpvar comes from a seperate file links.ini (sorry if I'm boring you, since it's all evident in the code, but I don't wanna miss anything out for anyone who can help)
I have added some rules to the .htaccess file in the root of this directory where index.php is located. The rules that have been added are
RewriteEngine On
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php?l=$1 [L]
The links.ini file looks like this:
ex = https://www.example.com
So the Main Issue is: When I browse the URL http://www.yoursite.com/short/index.php?l=ex , and Click the Button to initiate the function go(), it doesn't take me to the website https://www.example.com
Once again, Thanks to anyone who solves/helps to solve the issue.