String.replace() requires two parameters. As written, it will look for the string “index.php” and replace it with nothing. Try adding a regex to match everything and replace with your new URL.
setTimeout(function() {
window.location.replace( /.*/, "index.php");
},1000);
Use the full URL (i.e. https://yourdomain.com/index.php
) or write a better regex. For instance, if your domain ends with .com, you could do something like:
setTimeout(function() {
window.location.replace( /\.com\/.*/, ".com/index.php");
},1000);